Skip to content

Commit

Permalink
Version 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
luigifab committed Oct 11, 2015
1 parent 4bbc1e5 commit 6338c22
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 69 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Created J/07/02/2013
* Updated S/11/04/2015
* Version 8
* Updated S/16/05/2015
* Version 9
*
* Copyright 2011-2015 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://redmine.luigifab.info/projects/magento/wiki/versioning
Expand Down Expand Up @@ -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();

Expand Down
16 changes: 9 additions & 7 deletions app/code/community/Luigifab/Versioning/Model/Scm/Git.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Created S/03/12/2011
* Updated D/05/04/2015
* Version 27
* Updated D/06/09/2015
* Version 28
*
* Copyright 2011-2015 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://redmine.luigifab.info/projects/magento/wiki/versioning
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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));
}
Expand Down
27 changes: 18 additions & 9 deletions app/code/community/Luigifab/Versioning/Model/Upgrade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Created V/27/02/2015
* Updated J/14/05/2015
* Version 51
* Updated L/07/09/2015
* Version 52
*
* Copyright 2011-2015 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://redmine.luigifab.info/projects/magento/wiki/versioning
Expand Down Expand Up @@ -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) {
Expand All @@ -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);

Expand All @@ -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']);

Expand Down Expand Up @@ -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',
Expand All @@ -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.'));
}
}
}

Expand Down
10 changes: 8 additions & 2 deletions app/code/community/Luigifab/Versioning/etc/adminhtml.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Created J/22/12/2011
* Updated M/19/08/2014
* Version 13
* Updated L/07/09/2015
* Version 14
*
* Copyright 2011-2015 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://redmine.luigifab.info/projects/magento/wiki/versioning
Expand Down Expand Up @@ -52,6 +52,12 @@
<versioning translate="title">
<title>Version control</title>
<sort_order>72</sort_order>
<children>
<upgrade translate="title">
<title>Perform upgrade</title>
<sort_order>1</sort_order>
</upgrade>
</children>
</versioning>
</children>
</tools>
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Luigifab/Versioning/etc/config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Created S/03/12/2011
* Updated J/14/05/2015
* Updated L/07/09/2015
* Version 28
*
* Copyright 2011-2015 | Fabrice Creuzot (luigifab) <code~luigifab~info>
Expand All @@ -21,7 +21,7 @@
<config>
<modules>
<Luigifab_Versioning>
<version>3.0.3</version>
<version>3.1.0</version>
</Luigifab_Versioning>
</modules>
<global>
Expand Down
26 changes: 13 additions & 13 deletions app/code/community/Luigifab/Versioning/etc/system.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Created S/03/12/2011
* Updated S/04/04/2015
* Version 45
* Updated M/01/09/2015
* Version 46
*
* Copyright 2011-2015 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://redmine.luigifab.info/projects/magento/wiki/versioning
Expand Down Expand Up @@ -121,7 +121,7 @@
<show_in_store>1</show_in_store>
</error503_pagetitle>
<error503_title translate="label">
<label>Title</label>
<label>Main title</label>
<frontend_type>text</frontend_type>
<sort_order>22</sort_order>
<show_in_default>1</show_in_default>
Expand All @@ -130,7 +130,7 @@
</error503_title>
<error503_content translate="label comment">
<label><![CDATA[Content text or <abbr title="HyperText Markup Language">HTML</abbr>]]></label>
<comment><![CDATA[Use %date[format]% to display start date.<br />Use format of <a href="http://us.php.net/strftime" onclick="window.open(this.href); return false;">strftime</a> function.]]></comment>
<comment><![CDATA[Use <b>%date[format]%</b> to display start date.<br />Use format of <a href="http://us.php.net/strftime" onclick="window.open(this.href); return false;">strftime</a> function.]]></comment>
<frontend_type>textarea</frontend_type>
<sort_order>23</sort_order>
<show_in_default>1</show_in_default>
Expand All @@ -139,7 +139,7 @@
</error503_content>
<error503_autoreload translate="label comment">
<label>Auto reload text and delay</label>
<comment>Use [10] for 10 seconds and delay.</comment>
<comment><![CDATA[Use <b>[10]</b> for 10 seconds and delay.]]></comment>
<frontend_type>text</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>24</sort_order>
Expand All @@ -149,7 +149,7 @@
</error503_autoreload>
<error503_byip translate="label comment">
<label>Disable page from these IP addresses</label>
<comment>Addresses separated by space.</comment>
<comment>Separate addresses by space.</comment>
<sort_order>25</sort_order>
<frontend_type>text</frontend_type>
<show_in_default>1</show_in_default>
Expand All @@ -174,7 +174,7 @@
<show_in_store>1</show_in_store>
</upgrade_pagetitle>
<upgrade_title translate="label">
<label>Title</label>
<label>Main title</label>
<frontend_type>text</frontend_type>
<sort_order>32</sort_order>
<show_in_default>1</show_in_default>
Expand All @@ -183,7 +183,7 @@
</upgrade_title>
<upgrade_content translate="label comment">
<label><![CDATA[Content text or <abbr title="HyperText Markup Language">HTML</abbr>]]></label>
<comment><![CDATA[Use %date[format]% to display start date.<br />Use format of <a href="http://us.php.net/strftime" onclick="window.open(this.href); return false;">strftime</a> function.]]></comment>
<comment><![CDATA[Use <b>%date[format]%</b> to display start date.<br />Use format of <a href="http://us.php.net/strftime" onclick="window.open(this.href); return false;">strftime</a> function.]]></comment>
<frontend_type>textarea</frontend_type>
<sort_order>33</sort_order>
<show_in_default>1</show_in_default>
Expand All @@ -192,7 +192,7 @@
</upgrade_content>
<upgrade_autoreload translate="label comment">
<label>Auto reload text and delay</label>
<comment>Use [10] for 10 seconds and delay.</comment>
<comment><![CDATA[Use <b>[10]</b> for 10 seconds and delay.]]></comment>
<frontend_type>text</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>34</sort_order>
Expand All @@ -202,7 +202,7 @@
</upgrade_autoreload>
<upgrade_byip translate="label comment">
<label>Disable page from these IP addresses</label>
<comment>Addresses separated by space.</comment>
<comment>Separate addresses by space.</comment>
<sort_order>35</sort_order>
<frontend_type>text</frontend_type>
<show_in_default>1</show_in_default>
Expand All @@ -227,7 +227,7 @@
<show_in_store>1</show_in_store>
</report_pagetitle>
<report_title translate="label">
<label>Title</label>
<label>Main title</label>
<frontend_type>text</frontend_type>
<sort_order>42</sort_order>
<show_in_default>1</show_in_default>
Expand All @@ -244,7 +244,7 @@
</report_content>
<report_email translate="label comment">
<label>Send report by email to</label>
<comment>Emails separated by space.</comment>
<comment>Separate addresses by space.</comment>
<frontend_type>text</frontend_type>
<!--backend_model>adminhtml/system_config_backend_email_address</backend_model-->
<sort_order>44</sort_order>
Expand All @@ -270,7 +270,7 @@
<show_in_store>1</show_in_store>
</error404_pagetitle>
<error404_title translate="label">
<label>Title</label>
<label>Main title</label>
<frontend_type>text</frontend_type>
<sort_order>52</sort_order>
<show_in_default>1</show_in_default>
Expand Down
16 changes: 9 additions & 7 deletions app/locale/fr_CA/Luigifab_Versioning.csv
Original file line number Diff line number Diff line change
@@ -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].<br />The <em>maintenace.flag</em> page takes priority over the <em>upgrade.flag</em> page.","Attention ! Ici, [vue magasin] = [langue].<br />La page <em>maintenace.flag</em> à priorité sur la page <em>upgrade.flag</em>."
"Error 503 (maintenance.flag)","Erreur 503 (maintenance.flag)"
"Warning! Here, [store view] = [lang].<br />The <em>maintenace.flag</em> page takes priority over the <em>upgrade.flag</em> page.","Attention ! Ici, [vue magasin] = [langue].<br />La page <em lang=""en"">maintenace.flag</em> à priorité sur la page <em lang=""en"">upgrade.flag</em>."
"Error 503 (maintenance.flag)","Erreur 503 (<span lang=""en"">maintenance.flag</span>)"
"Page title","Titre de la page"
"Main title","Titre principal"
"Content text or <abbr title=""HyperText Markup Language"">HTML</abbr>","Contenu texte ou <abbr title=""Langage de balisage hypertexte (HyperText Markup Language)"">HTML</abbr>"
"Use %date[format]% to display start date.<br />Use format of <a href=""http://us.php.net/strftime"" onclick=""window.open(this.href); return false;"">strftime</a> function.","Utiliser %date[format]% pour afficher la date de début.<br />Utiliser le format de la fonction <a href=""http://fr.php.net/strftime"" onclick=""window.open(this.href); return false;"">strftime</a>."
"Use <b>%date[format]%</b> to display start date.<br />Use format of <a href=""http://us.php.net/strftime"" onclick=""window.open(this.href); return false;"">strftime</a> function.","Utiliser <b>%date[format]%</b> pour afficher la date de début.<br />Utiliser le format de la fonction <a href=""http://fr.php.net/strftime"" onclick=""window.open(this.href); return false;"" lang=""en"">strftime</a>."
"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 <b>[10]</b> for 10 seconds and delay.","Utiliser <b>[10]</b> 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 (<span lang=""en"">upgrade.flag</span>)"
"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"
Expand Down Expand Up @@ -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)"
Expand Down
16 changes: 9 additions & 7 deletions app/locale/fr_FR/Luigifab_Versioning.csv
Original file line number Diff line number Diff line change
@@ -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].<br />The <em>maintenace.flag</em> page takes priority over the <em>upgrade.flag</em> page.","Attention ! Ici, [vue magasin] = [langue].<br />La page <em>maintenace.flag</em> à priorité sur la page <em>upgrade.flag</em>."
"Error 503 (maintenance.flag)","Erreur 503 (maintenance.flag)"
"Warning! Here, [store view] = [lang].<br />The <em>maintenace.flag</em> page takes priority over the <em>upgrade.flag</em> page.","Attention ! Ici, [vue magasin] = [langue].<br />La page <em lang=""en"">maintenace.flag</em> à priorité sur la page <em lang=""en"">upgrade.flag</em>."
"Error 503 (maintenance.flag)","Erreur 503 (<span lang=""en"">maintenance.flag</span>)"
"Page title","Titre de la page"
"Main title","Titre principal"
"Content text or <abbr title=""HyperText Markup Language"">HTML</abbr>","Contenu texte ou <abbr title=""Langage de balisage hypertexte (HyperText Markup Language)"">HTML</abbr>"
"Use %date[format]% to display start date.<br />Use format of <a href=""http://us.php.net/strftime"" onclick=""window.open(this.href); return false;"">strftime</a> function.","Utiliser %date[format]% pour afficher la date de début.<br />Utiliser le format de la fonction <a href=""http://fr.php.net/strftime"" onclick=""window.open(this.href); return false;"">strftime</a>."
"Use <b>%date[format]%</b> to display start date.<br />Use format of <a href=""http://us.php.net/strftime"" onclick=""window.open(this.href); return false;"">strftime</a> function.","Utiliser <b>%date[format]%</b> pour afficher la date de début.<br />Utiliser le format de la fonction <a href=""http://fr.php.net/strftime"" onclick=""window.open(this.href); return false;"" lang=""en"">strftime</a>."
"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 <b>[10]</b> for 10 seconds and delay.","Utiliser <b>[10]</b> 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 (<span lang=""en"">upgrade.flag</span>)"
"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"
Expand Down Expand Up @@ -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)"
Expand Down
Loading

0 comments on commit 6338c22

Please sign in to comment.