From 6338c2200083fe890b91336037ad47a68ac8116a Mon Sep 17 00:00:00 2001 From: Fabrice Creuzot Date: Sun, 11 Oct 2015 20:00:00 +0200 Subject: [PATCH] Version 3.1.0 --- README.md | 2 +- .../Block/Adminhtml/Config/Heading.php | 16 +++++------ .../Luigifab/Versioning/Model/Scm/Git.php | 16 ++++++----- .../Luigifab/Versioning/Model/Upgrade.php | 27 ++++++++++++------- .../Luigifab/Versioning/etc/adminhtml.xml | 10 +++++-- .../Luigifab/Versioning/etc/config.xml | 4 +-- .../Luigifab/Versioning/etc/system.xml | 26 +++++++++--------- app/locale/fr_CA/Luigifab_Versioning.csv | 16 ++++++----- app/locale/fr_FR/Luigifab_Versioning.csv | 16 ++++++----- errors/processor.php | 9 +++++-- package.xml | 13 +++++---- .../css/luigifab/versioning/styles.css | 5 ++-- .../css/luigifab/versioning/styles.min.css | 5 ++-- 13 files changed, 96 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index f4fe375..9683591 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ For more information, go to https://www.luigifab.fr/magento/versioning (IPv6 is This repository is a mirror. To install the module, please use the extension key available in the documentation. If you like, take some of your time to improve the translations, go to https://bit.ly/2HyCCEc. -Version 3.0.3 released on 14/05/2015. +Version 3.1.0 released on 11/10/2015. diff --git a/app/code/community/Luigifab/Versioning/Block/Adminhtml/Config/Heading.php b/app/code/community/Luigifab/Versioning/Block/Adminhtml/Config/Heading.php index 32bc22c..8bbc7cb 100644 --- a/app/code/community/Luigifab/Versioning/Block/Adminhtml/Config/Heading.php +++ b/app/code/community/Luigifab/Versioning/Block/Adminhtml/Config/Heading.php @@ -1,8 +1,8 @@ * https://redmine.luigifab.info/projects/magento/wiki/versioning @@ -45,13 +45,13 @@ public function render(Varien_Data_Form_Element_Abstract $element) { private function getStoreId() { - $pWebsite = Mage::app()->getRequest()->getParam('website'); - $pStore = Mage::app()->getRequest()->getParam('store'); + $website = $this->getRequest()->getParam('website'); + $store = $this->getRequest()->getParam('store'); - if (strlen($pStore) > 0) - $storeId = Mage::getModel('core/store')->load($pStore)->getStoreId(); - else if (strlen($pWebsite) > 0) - $storeId = Mage::getModel('core/website')->load($pWebsite)->getDefaultStore()->getStoreId(); + if (strlen($store) > 0) + $storeId = Mage::getModel('core/store')->load($store)->getStoreId(); + else if (strlen($website) > 0) + $storeId = Mage::getModel('core/website')->load($website)->getDefaultStore()->getStoreId(); else $storeId = Mage::app()->getDefaultStoreView()->getStoreId(); diff --git a/app/code/community/Luigifab/Versioning/Model/Scm/Git.php b/app/code/community/Luigifab/Versioning/Model/Scm/Git.php index d40fbd9..1a3c2e0 100644 --- a/app/code/community/Luigifab/Versioning/Model/Scm/Git.php +++ b/app/code/community/Luigifab/Versioning/Model/Scm/Git.php @@ -1,8 +1,8 @@ * https://redmine.luigifab.info/projects/magento/wiki/versioning @@ -46,7 +46,7 @@ public function getType() { // #### Historique ############################################################## public ### // - // = révision : 67 + // = révision : 68 // » Génère une collection à partir de l'historique des commits du dépôt // » Met en forme les données à partir de la réponse de pleins de commandes // » Utilise GIT_SSH si le fichier de configuration existe @@ -114,7 +114,7 @@ public function getCommitCollection() { if (strlen($refs) > 2) { $refs = substr($refs, 1, -1); - $refs = str_replace(array('origin/','HEAD',' '), '', $refs); + $refs = str_replace(array('origin/','HEAD',' ','->'), '', $refs); $refs = preg_replace('#,{2,}#', ',', $refs); $refs = trim($refs, ' ,'); $refs = explode(',', $refs); @@ -338,7 +338,7 @@ public function getCurrentBranch() { // #### Mise à jour ############################################################# public ### // - // = révision : 10 + // = révision : 11 // » Met à jour la copie locale avec 'git reset' (après avoir annulé les éventuelles modifications avec 'git clean') // » Prend soin de vérifier le code de retour de la commande 'git reset' et d'enregistrer les détails de la mise à jour // » N'utilise pas GIT_SSH étant donnée que tout est disponible sur le dépôt local @@ -355,10 +355,12 @@ public function upgradeToRevision($obj, $log, $revision) { git reset --hard '.$revision.' >> '.$log.' 2>&1; ', $data, $val); - $data = trim(file_get_contents($log)); + $data = trim(file_get_contents($log)); + $lines = explode("\n", $data); + $obj->writeCommand($data); - foreach (explode("\n", $data) as $line) { + foreach ($lines as $line) { if (strpos($line, 'fatal: ') === 0) throw new Exception(str_replace('fatal: ', '', $line)); } diff --git a/app/code/community/Luigifab/Versioning/Model/Upgrade.php b/app/code/community/Luigifab/Versioning/Model/Upgrade.php index 7e3b9cc..31e0ab3 100644 --- a/app/code/community/Luigifab/Versioning/Model/Upgrade.php +++ b/app/code/community/Luigifab/Versioning/Model/Upgrade.php @@ -1,8 +1,8 @@ * https://redmine.luigifab.info/projects/magento/wiki/versioning @@ -52,7 +52,7 @@ public function disableAllBuffer() { // #### Gestion de la mise à jour ####################################### i18n ## public ### // - // = révision : 87 + // = révision : 88 // » Log toutes les informations de la mise à jour // » Déroule le processus de mise à jour public function process($targetRevision, $useFlag) { @@ -78,6 +78,12 @@ public function process($targetRevision, $useFlag) { // ÉTAPE 1 $this->writeTitle($this->__('1) Locking and configuration check')); + if (Mage::getSingleton('admin/session')->isAllowed('tools/versioning_upgrade') !== true) + throw new Exception('Not authorized'); + + if (is_file($lock)) + throw new Exception('An upgrade is already underway'); + if (is_file($log)) unlink($log); @@ -88,9 +94,6 @@ public function process($targetRevision, $useFlag) { $this->writeNotice($this->__('Repository: %s / Current revision: %s / Requested revision: %s', $repository->getType(), $H['current_rev'], $targetRevision)); - if (is_file($lock)) - throw new Exception('An upgrade is already underway'); - if ($useFlag) file_put_contents($this->getUpgradeFlag(), $H['current_rev'].' » '.$H['target_rev'].' from '.$H['remote_addr'].' by '.$H['user']); @@ -134,7 +137,7 @@ public function process($targetRevision, $useFlag) { $H['duration'] = ($H['duration'] < 1000) ? $H['duration'] : 1; $H['status'] = (is_file($log) && is_readable($log)) ? $e->getMessage()."\n".trim(file_get_contents($log)) : $e->getMessage(); - if ($e->getMessage() !== 'An upgrade is already underway') { + if (!in_array($e->getMessage(), array('Not authorized', 'An upgrade is already underway'))) { $result = array( 'url' => '*/versioning_repository/history', @@ -161,8 +164,14 @@ public function process($targetRevision, $useFlag) { 'error' => true ); - $this->writeError($this->__('Stop! Stop! Stop! An upgrade is already underway.')); - Mage::getSingleton('adminhtml/session')->addError($this->__('Please wait, an upgrade is already underway.')); + if ($e->getMessage() === 'An upgrade is already underway') { + $this->writeError($this->__('Stop! Stop! Stop! An upgrade is already underway.')); + Mage::getSingleton('adminhtml/session')->addError($this->__('Please wait, an upgrade is already underway.')); + } + else { + $this->writeError($this->__('You are not authorized to perform this operation.')); + Mage::getSingleton('adminhtml/session')->addError($this->__('You are not authorized to perform this operation.')); + } } } diff --git a/app/code/community/Luigifab/Versioning/etc/adminhtml.xml b/app/code/community/Luigifab/Versioning/etc/adminhtml.xml index c61561b..52dd167 100644 --- a/app/code/community/Luigifab/Versioning/etc/adminhtml.xml +++ b/app/code/community/Luigifab/Versioning/etc/adminhtml.xml @@ -1,8 +1,8 @@ 44 @@ -270,7 +270,7 @@ 1 - + text 52 1 diff --git a/app/locale/fr_CA/Luigifab_Versioning.csv b/app/locale/fr_CA/Luigifab_Versioning.csv index 6873e31..3c03cfc 100644 --- a/app/locale/fr_CA/Luigifab_Versioning.csv +++ b/app/locale/fr_CA/Luigifab_Versioning.csv @@ -1,21 +1,22 @@ "Version control","Gestionnaire de version" +"Perform upgrade","Procéder aux mises à jour" "Versioning","Gestionnaire de version" "Number of commits per page","Nombre de commits par page" "Bug tracker","Gestionnaire de projet" "Downtime pages","Pages de maintenance" -"Warning! Here, [store view] = [lang].
The maintenace.flag page takes priority over the upgrade.flag page.","Attention ! Ici, [vue magasin] = [langue].
La page maintenace.flag à priorité sur la page upgrade.flag." -"Error 503 (maintenance.flag)","Erreur 503 (maintenance.flag)" +"Warning! Here, [store view] = [lang].
The maintenace.flag page takes priority over the upgrade.flag page.","Attention ! Ici, [vue magasin] = [langue].
La page maintenace.flag à priorité sur la page upgrade.flag." +"Error 503 (maintenance.flag)","Erreur 503 (maintenance.flag)" "Page title","Titre de la page" +"Main title","Titre principal" "Content text or HTML","Contenu texte ou HTML" -"Use %date[format]% to display start date.
Use format of strftime function.","Utiliser %date[format]% pour afficher la date de début.
Utiliser le format de la fonction strftime." +"Use %date[format]% to display start date.
Use format of strftime function.","Utiliser %date[format]% pour afficher la date de début.
Utiliser le format de la fonction strftime." "Auto reload text and delay","Texte avec délai du rechargement automatique" -"Use [10] for 10 seconds and delay.","Utiliser [10] pour 10 secondes de délai." +"Use [10] for 10 seconds and delay.","Utiliser [10] pour 10 secondes de délai." "Disable page from these IP addresses","Désactiver la page à partir des adresses IP suivantes" -"Addresses separated by space.","Adresses séparées par un espace." -"Upgrade (upgrade.flag)","Mise à jour (upgrade.flag)" +"Separate addresses by space.","Séparer les adresses par un espace." +"Upgrade (upgrade.flag)","Mise à jour (upgrade.flag)" "Error report","Rapport d'erreur" "Send report by email to","Envoyer le rapport par email à" -"Emails separated by space.","Adresses séparées par un espace." "System error 404","Erreur 404 système" "Versioning / Tools / Magento Admin","Gestionnaire de version / Outils / Admin Magento" "Preview in %s","Aperçu en %s" @@ -63,6 +64,7 @@ "Upgrade to revision %s completed.","Mise à jour vers la révision %s terminée." "Upgrade error (revision %s)","Échec de mise à jour (révision %s)" "Please wait, an upgrade is already underway.","Veuillez patienter, une mise à jour est en cours." +"You are not authorized to perform this operation.","Vous n'êtes pas autorisé(e) à effectuer cette opération." "Please configure the module before use it.","Veuillez configurer le module avant de l'utiliser." "Upgrading","Mise à jour" "Starting upgrade (revision %s)","Démarrage de la mise à jour (révision %s)" diff --git a/app/locale/fr_FR/Luigifab_Versioning.csv b/app/locale/fr_FR/Luigifab_Versioning.csv index 6873e31..3c03cfc 100644 --- a/app/locale/fr_FR/Luigifab_Versioning.csv +++ b/app/locale/fr_FR/Luigifab_Versioning.csv @@ -1,21 +1,22 @@ "Version control","Gestionnaire de version" +"Perform upgrade","Procéder aux mises à jour" "Versioning","Gestionnaire de version" "Number of commits per page","Nombre de commits par page" "Bug tracker","Gestionnaire de projet" "Downtime pages","Pages de maintenance" -"Warning! Here, [store view] = [lang].
The maintenace.flag page takes priority over the upgrade.flag page.","Attention ! Ici, [vue magasin] = [langue].
La page maintenace.flag à priorité sur la page upgrade.flag." -"Error 503 (maintenance.flag)","Erreur 503 (maintenance.flag)" +"Warning! Here, [store view] = [lang].
The maintenace.flag page takes priority over the upgrade.flag page.","Attention ! Ici, [vue magasin] = [langue].
La page maintenace.flag à priorité sur la page upgrade.flag." +"Error 503 (maintenance.flag)","Erreur 503 (maintenance.flag)" "Page title","Titre de la page" +"Main title","Titre principal" "Content text or HTML","Contenu texte ou HTML" -"Use %date[format]% to display start date.
Use format of strftime function.","Utiliser %date[format]% pour afficher la date de début.
Utiliser le format de la fonction strftime." +"Use %date[format]% to display start date.
Use format of strftime function.","Utiliser %date[format]% pour afficher la date de début.
Utiliser le format de la fonction strftime." "Auto reload text and delay","Texte avec délai du rechargement automatique" -"Use [10] for 10 seconds and delay.","Utiliser [10] pour 10 secondes de délai." +"Use [10] for 10 seconds and delay.","Utiliser [10] pour 10 secondes de délai." "Disable page from these IP addresses","Désactiver la page à partir des adresses IP suivantes" -"Addresses separated by space.","Adresses séparées par un espace." -"Upgrade (upgrade.flag)","Mise à jour (upgrade.flag)" +"Separate addresses by space.","Séparer les adresses par un espace." +"Upgrade (upgrade.flag)","Mise à jour (upgrade.flag)" "Error report","Rapport d'erreur" "Send report by email to","Envoyer le rapport par email à" -"Emails separated by space.","Adresses séparées par un espace." "System error 404","Erreur 404 système" "Versioning / Tools / Magento Admin","Gestionnaire de version / Outils / Admin Magento" "Preview in %s","Aperçu en %s" @@ -63,6 +64,7 @@ "Upgrade to revision %s completed.","Mise à jour vers la révision %s terminée." "Upgrade error (revision %s)","Échec de mise à jour (révision %s)" "Please wait, an upgrade is already underway.","Veuillez patienter, une mise à jour est en cours." +"You are not authorized to perform this operation.","Vous n'êtes pas autorisé(e) à effectuer cette opération." "Please configure the module before use it.","Veuillez configurer le module avant de l'utiliser." "Upgrading","Mise à jour" "Starting upgrade (revision %s)","Démarrage de la mise à jour (révision %s)" diff --git a/errors/processor.php b/errors/processor.php index 21b05cd..92b0fb9 100644 --- a/errors/processor.php +++ b/errors/processor.php @@ -1,7 +1,7 @@ @@ -103,7 +103,7 @@ public function init($type) { // #### Contenu de la page ############################################## i18n ## public ### // - // = révision : 15 + // = révision : 16 // » Renvoi le contenu de la page (éventuellement en utilisant des expressions régulières) // » En fonction de la configuration, en fonction du contexte public function getPageTitle() { @@ -131,6 +131,8 @@ public function getHtmlContent() { $text = preg_replace_callback('#%date\[([^\]]+)\]%#', array($this, 'searchReplaceUpgrade'), $text); else if (($this->getData('type') === 'error503') && is_file(ROOT.'/maintenance.flag')) $text = preg_replace_callback('#%date\[([^\]]+)\]%#', array($this, 'searchReplaceMaintenance'), $text); + else if (($this->getData('type') === 'upgrade') || ($this->getData('type') === 'error503')) + $text = preg_replace_callback('#%date\[([^\]]+)\]%#', array($this, 'searchReplaceDemo'), $text); return $text; } @@ -145,6 +147,9 @@ public function searchReplaceMaintenance($matches) { return strftime($matches[1], $time); } + public function searchReplaceDemo($matches) { + return strftime($matches[1]); + } // #### Génération des adresses ################################################# public ### // // = révision : 5 diff --git a/package.xml b/package.xml index e549d1c..52c634d 100644 --- a/package.xml +++ b/package.xml @@ -1,19 +1,18 @@ Luigifab_Versioning - 3.0.3 + 3.1.0 stable GPL luigifab - Synchronize your Magento installation with your version control system. - + Synchronize your Magento installation with your version control system. Synchronize your Magento installation with your version control system. Oh yeah! Fabrice Creuzotluigifabcode@luigifab.info - 2015-05-14 - - + 2015-09-12 + + - 5.2.06.9.9 + 5.2.07.9.9 diff --git a/skin/adminhtml/default/default/css/luigifab/versioning/styles.css b/skin/adminhtml/default/default/css/luigifab/versioning/styles.css index fceb416..39da5f4 100644 --- a/skin/adminhtml/default/default/css/luigifab/versioning/styles.css +++ b/skin/adminhtml/default/default/css/luigifab/versioning/styles.css @@ -1,6 +1,6 @@ /** * Copyright 2011-2015 | Fabrice Creuzot (luigifab) - * Created J/22/12/2011, updated J/14/05/2015, version 54 + * Created J/22/12/2011, updated M/01/09/2015, version 56 * https://redmine.luigifab.info/projects/magento/wiki/versioning * * This program is free software, you can redistribute it or modify @@ -52,6 +52,7 @@ body.adminhtml-versioning-repository-history #loading_mask_loader { margin-left: #config_edit_form[action*="system_config/save/section/versioning"] p.note { padding-top:3px; line-height:135%; } #config_edit_form[action*="system_config/save/section/versioning"] [id*="downtime"] tr td.value input { width:400px; } #config_edit_form[action*="system_config/save/section/versioning"] [id*="downtime"] tr td.value textarea { width:400px; height:10em; } +#config_edit_form[action*="system_config/save/section/versioning"] [id*="downtime"] tr td.value p.note { width:400px; } /* &&&&&&&&&&&&& versioning/repository/history,status &&& */ body.adminhtml-versioning-repository-status pre ins { display:inline-block; width:100%; text-decoration:none; background-color:#CFC; } @@ -111,7 +112,7 @@ body.adminhtml-versioning-repository-index #apijsDialog { } #apijsBox.versioning { background-color:rgba(255,255,255, 0.6); opacity:1; box-shadow:none; -moz-box-shadow:none; -webkit-box-shadow:none; } -#apijsBox.versioning h1 { padding-left:23px; min-height:1.2em; font-size:1.2em; line-height:1.2em; color:#EB5E00; } +#apijsBox.versioning h1 { padding-left:23px; height:1.2em; min-height:1.2em; font-size:1.2em; line-height:1.2em; color:#EB5E00; } #apijsBox.versioning.bzr h1 { background:url("../../../images/luigifab/versioning/bzr.png") no-repeat left center; } #apijsBox.versioning.git h1 { background:url("../../../images/luigifab/versioning/git.png") no-repeat left center; } #apijsBox.versioning.svn h1 { background:url("../../../images/luigifab/versioning/svn.png") no-repeat left center; } diff --git a/skin/adminhtml/default/default/css/luigifab/versioning/styles.min.css b/skin/adminhtml/default/default/css/luigifab/versioning/styles.min.css index 7b4c483..9130f38 100644 --- a/skin/adminhtml/default/default/css/luigifab/versioning/styles.min.css +++ b/skin/adminhtml/default/default/css/luigifab/versioning/styles.min.css @@ -1,7 +1,7 @@ @charset "utf-8"; /** * Copyright 2011-2015 | Fabrice Creuzot (luigifab) - * Created J/22/12/2011,updated J/14/05/2015,version 54 + * Created J/22/12/2011,updated M/01/09/2015,version 56 * https://redmine.luigifab.info/projects/magento/wiki/versioning * * This program is free software,you can redistribute it or modify @@ -22,6 +22,7 @@ body.adminhtml-versioning-repository-history #loading_mask_loader{margin-left:-1 #config_edit_form[action*="system_config/save/section/versioning"] p.note{padding-top:3px;line-height:135%;} #config_edit_form[action*="system_config/save/section/versioning"] [id*="downtime"] tr td.value input{width:400px;} #config_edit_form[action*="system_config/save/section/versioning"] [id*="downtime"] tr td.value textarea{width:400px;height:10em;} +#config_edit_form[action*="system_config/save/section/versioning"] [id*="downtime"] tr td.value p.note{width:400px;} body.adminhtml-versioning-repository-status pre ins{display:inline-block;width:100%;text-decoration:none;background-color:#CFC;} body.adminhtml-versioning-repository-status pre del{display:inline-block;width:100%;text-decoration:none;background-color:#FCC;} body.adminhtml-versioning-repository-status pre strong{display:inline-block;width:100%;} @@ -50,7 +51,7 @@ body.adminhtml-versioning-repository-index div.grid div.hor-scroll svg{position: body.adminhtml-versioning-repository-index p.credits{position:absolute;bottom:1.2em;left:1em;color:#CCC;} body.adminhtml-versioning-repository-index #apijsDialog{background-color:#111;background-size:100% 100%;background-image:url("../../../images/luigifab/versioning/mars-sunset.jpg");} #apijsBox.versioning{background-color:rgba(255,255,255,.6);opacity:1;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;} -#apijsBox.versioning h1{padding-left:23px;min-height:1.2em;font-size:1.2em;line-height:1.2em;color:#EB5E00;} +#apijsBox.versioning h1{padding-left:23px;height:1.2em;min-height:1.2em;font-size:1.2em;line-height:1.2em;color:#EB5E00;} #apijsBox.versioning.bzr h1{background:url("../../../images/luigifab/versioning/bzr.png") no-repeat left center;} #apijsBox.versioning.git h1{background:url("../../../images/luigifab/versioning/git.png") no-repeat left center;} #apijsBox.versioning.svn h1{background:url("../../../images/luigifab/versioning/svn.png") no-repeat left center;}