コード例 #1
0
    public function display()
    {
        // We need jquery 1.6 for json
        // do we ?
        echo '<script type="text/javascript">
		if (jQuery == "undefined")
			jq13 = jQuery.noConflict(true);
			</script>
		<script type="text/javascript" src="' . __PS_BASE_URI__ . 'modules/autoupgrade/jquery-1.6.2.min.js"></script>';
        $this->createCustomToken();
        /* PrestaShop demo mode */
        if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_) {
            echo '<div class="error">' . $this->l('This functionnality has been disabled.') . '</div>';
            return;
        }
        if (!file_exists($this->autoupgradePath . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
            echo '<div class="error">' . '<img src="../img/admin/warning.gif" /> [TECHNICAL ERROR] ' . $this->l('ajax-upgradetab.php is missing. please reinstall or reset the module') . '</div>';
            return false;
        }
        /* PrestaShop demo mode*/
        // in order to not use Tools class
        if (isset($_GET['refreshCurrentVersion'])) {
            $upgrader = new Upgrader();
            $upgrader->checkPSVersion(true);
            // delete the potential xml files we saved in config/xml (from last release and from current)
            $upgrader->clearXmlMd5File(_PS_VERSION_);
            $upgrader->clearXmlMd5File($upgrader->version_num);
            $this->upgrader = $upgrader;
        }
        echo '<style>
.autoupgradeSteps div {  line-height: 30px; }
.upgradestep { margin-right: 5px;padding-left: 10px; padding-right: 5px;}
#upgradeNow.stepok, .autoupgradeSteps a.stepok { background-image: url("../img/admin/enabled.gif");background-position: left center;background-repeat: no-repeat;padding-left: 15px;}
#upgradeNow {-moz-border-bottom-colors: none;-moz-border-image: none;-moz-border-left-colors: none;-moz-border-right-colors: none;-moz-border-top-colors: none;border-color: #FFF6D3 #DFD5AF #DFD5AF #FFF6D3;border-right: 1px solid #DFD5AF;border-style: solid;border-width: 1px;color: #268CCD;font-size: medium;padding: 5px;}
.button-autoupgrade {-moz-border-bottom-colors: none;-moz-border-image: none;-moz-border-left-colors: none;-moz-border-right-colors: none;-moz-border-top-colors: none;border-color: #FFF6D3 #DFD5AF #DFD5AF #FFF6D3;border-right: 1px solid #DFD5AF;border-style: solid;border-width: 1px;color: #268CCD;font-size: medium;padding: 5px;}
.processing {border:2px outset grey;margin-top:1px;overflow: auto;}
#dbResultCheck{ padding-left:20px;}
#checkPrestaShopFilesVersion, #checkPrestaShopModifiedFiles{margin-bottom:20px;}
#changedList ul{list-style-type:circle}
.changedFileList {margin-left:20px; padding-left:5px;}
.changedNotice li{color:grey;}
.changedImportant li{color:red;font-weight:bold}
.upgradeDbError{background-color:red}
.upgradeDbOk{background-color:green}
.small_label{font-weight:normal;width:300px;float:none;text-align:left;padding:0}
</style>';
        $this->displayWarning($this->l('This function is experimental. It\'s highly recommended to make a backup of your files and database before starting the upgrade process.'));
        global $currentIndex;
        // update['name'] = version name
        // update['num'] = only the version
        // update['link'] = download link
        // @TODO
        if ($this->useSvn) {
            echo '<div class="error"><h1>' . $this->l('Unstable upgrade') . '</h1>
				<p class="warning">' . $this->l('Your current configuration indicate you want to upgrade your system from the unstable development branch, with no version number. If you upgrade, you will not be able to follow the official release process anymore') . '.</p>
				</div>';
        }
        $this->_displayUpgraderForm();
        echo '<br/>';
        $this->_displayRollbackForm();
        echo '<br/>';
        $this->_displayForm('autoUpgradeOptions', $this->_fieldsAutoUpgrade, '<a href="" name="options" id="options">' . $this->l('Options') . '</a>', '', 'prefs');
        // @todo manual upload with a form
        echo '<script type="text/javascript" src="' . __PS_BASE_URI__ . 'modules/autoupgrade/jquery.xml2json.js"></script>';
        echo '<script type="text/javascript">' . $this->_getJsInit() . '</script>';
    }
コード例 #2
0
    public function display()
    {
        $this->_html .= '<script type="text/javascript">var jQueryVersionPS = parseInt($().jquery.replace(/\\./g, ""));</script>
		<script type="text/javascript" src="' . __PS_BASE_URI__ . 'modules/autoupgrade/js/jquery-1.6.2.min.js"></script>
		<script type="text/javascript">if (jQueryVersionPS >= 162) jq162 = jQuery.noConflict(true);</script>';
        /* PrestaShop demo mode */
        if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_) {
            echo '<div class="error">' . $this->l('This functionality has been disabled.') . '</div>';
            return;
        }
        if (!file_exists($this->autoupgradePath . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
            echo '<div class="error">' . '<img src="../img/admin/warning.gif" /> ' . $this->l('[TECHNICAL ERROR] ajax-upgradetab.php is missing. Please reinstall or reset the module.') . '</div>';
            return false;
        }
        /* PrestaShop demo mode*/
        // in order to not use Tools class
        $upgrader = new Upgrader();
        preg_match('#([0-9]+\\.[0-9]+)(?:\\.[0-9]+){1,2}#', _PS_VERSION_, $matches);
        $upgrader->branch = $matches[1];
        $channel = $this->getConfig('channel');
        switch ($channel) {
            case 'archive':
                $upgrader->channel = 'archive';
                $upgrader->version_num = $this->getConfig('archive.version_num');
                break;
            case 'directory':
                $upgrader->channel = 'directory';
                $upgrader->version_num = $this->getConfig('directory.version_num');
                break;
            default:
                $upgrader->channel = $channel;
                if (isset($_GET['refreshCurrentVersion'])) {
                    // delete the potential xml files we saved in config/xml (from last release and from current)
                    $upgrader->clearXmlMd5File(_PS_VERSION_);
                    $upgrader->clearXmlMd5File($upgrader->version_num);
                    if ($this->getConfig('channel') == 'private' && !$this->getConfig('private_allow_major')) {
                        $upgrader->checkPSVersion(true, array('private', 'minor'));
                    } else {
                        $upgrader->checkPSVersion(true, array('minor'));
                    }
                    Tools14::redirectAdmin($this->currentIndex . '&conf=5&token=' . Tools14::getValue('token'));
                } else {
                    if ($this->getConfig('channel') == 'private' && !$this->getConfig('private_allow_major')) {
                        $upgrader->checkPSVersion(false, array('private', 'minor'));
                    } else {
                        $upgrader->checkPSVersion(false, array('minor'));
                    }
                }
        }
        $this->upgrader = $upgrader;
        $this->_html .= '<link type="text/css" rel="stylesheet" href="' . __PS_BASE_URI__ . 'modules/autoupgrade/css/styles.css" />';
        $this->_html .= '<div class="bootstrap" id="informationBlock">
            <div class="panel">
                <div class="panel-heading">
                  ' . $this->l('Welcome!') . '
                </div>
                <p>
                    ' . $this->l('With the PrestaShop 1-Click Upgrade module, upgrading your store to the latest version available has never been easier!') . '<br /><br />
                    <span style="color:#CC0000;font-weight:bold">' . $this->l('Please always perform a full manual backup of your files and database before starting any upgrade.') . '</span><br />
                    ' . $this->l('Double-check the integrity of your backup and that you can easily manually roll-back if necessary.') . '<br />
                    ' . $this->l('If you do not know how to proceed, ask your hosting provider.') . '
                </p>
            </div>
            </div>';
        /* Make sure the user has configured the upgrade options, or set default values */
        $configuration_keys = array('PS_AUTOUP_UPDATE_DEFAULT_THEME' => 1, 'PS_AUTOUP_CHANGE_DEFAULT_THEME' => 0, 'PS_AUTOUP_KEEP_MAILS' => 0, 'PS_AUTOUP_CUSTOM_MOD_DESACT' => 1, 'PS_AUTOUP_MANUAL_MODE' => 0, 'PS_AUTOUP_PERFORMANCE' => 1, 'PS_DISPLAY_ERRORS' => 0);
        foreach ($configuration_keys as $k => $default_value) {
            if (Configuration::get($k) == '') {
                Configuration::updateValue($k, $default_value);
            }
        }
        /* Checks/requirements and "Upgrade PrestaShop now" blocks */
        $this->_displayCurrentConfiguration();
        $this->_displayBlockUpgradeButton();
        $this->_displayComparisonBlock();
        $this->_displayBlockActivityLog();
        $this->_displayRollbackForm();
        $this->_html .= '<br/>';
        $this->_html .= '<form action="' . $this->currentIndex . '&amp;customSubmitAutoUpgrade=1&amp;token=' . $this->token . '" method="post" class="form-horizontal" enctype="multipart/form-data">';
        $this->_displayForm('backupOptions', $this->_fieldsBackupOptions, '<a href="#" name="backup-options" id="backup-options">' . $this->l('Backup Options') . '</a>', '', 'database_gear');
        $this->_displayForm('upgradeOptions', $this->_fieldsUpgradeOptions, '<a href="#" name="upgrade-options" id="upgrade-options">' . $this->l('Upgrade Options') . '</a>', '', 'prefs');
        $this->_html .= '</form>';
        $this->_html .= '<script type="text/javascript" src="' . __PS_BASE_URI__ . 'modules/autoupgrade/js/jquery.xml2json.js"></script>';
        $this->_html .= '<script type="text/javascript">' . $this->_getJsInit() . '</script>';
        echo $this->_html;
    }
コード例 #3
0
    public function display()
    {
        global $currentIndex;
        // We need jquery 1.6 for json
        // do we ?
        $this->_html .= '<script type="text/javascript">
		if (jQuery == "undefined")
			jq13 = jQuery.noConflict(true);
			</script>
		<script type="text/javascript" src="' . __PS_BASE_URI__ . 'modules/autoupgrade/jquery-1.6.2.min.js"></script>';
        /* PrestaShop demo mode */
        if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_) {
            echo '<div class="error">' . $this->l('This functionnality has been disabled.') . '</div>';
            return;
        }
        if (!file_exists($this->autoupgradePath . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
            echo '<div class="error">' . '<img src="../img/admin/warning.gif" /> [TECHNICAL ERROR] ' . $this->l('ajax-upgradetab.php is missing. please reinstall or reset the module') . '</div>';
            return false;
        }
        /* PrestaShop demo mode*/
        // in order to not use Tools class
        $upgrader = new Upgrader();
        preg_match('#([0-9]+\\.[0-9]+)(?:\\.[0-9]+){1,2}#', _PS_VERSION_, $matches);
        $upgrader->branch = $matches[1];
        $channel = $this->getConfig('channel');
        switch ($channel) {
            case 'archive':
                $upgrader->channel = 'archive';
                $upgrader->version_num = $this->getConfig('archive.version_num');
                break;
            case 'directory':
                $upgrader->channel = 'directory';
                $upgrader->version_num = $this->getConfig('directory.version_num');
                break;
            default:
                $upgrader->channel = $channel;
                if (isset($_GET['refreshCurrentVersion'])) {
                    // delete the potential xml files we saved in config/xml (from last release and from current)
                    $upgrader->clearXmlMd5File(_PS_VERSION_);
                    $upgrader->clearXmlMd5File($upgrader->version_num);
                    if ($this->getConfig('channel') == 'private' && !$this->getConfig('private_allow_major')) {
                        $upgrader->checkPSVersion(true, array('private', 'minor'));
                    } else {
                        $upgrader->checkPSVersion(true, array('minor'));
                    }
                    Tools::redirectAdmin($currentIndex . '&conf=5&token=' . Tools::getValue('token'));
                } else {
                    if ($this->getConfig('channel') == 'private' && !$this->getConfig('private_allow_major')) {
                        $upgrader->checkPSVersion(false, array('private', 'minor'));
                    } else {
                        $upgrader->checkPSVersion(false, array('minor'));
                    }
                }
        }
        $this->upgrader = $upgrader;
        $this->_html .= '<style type="text/css">
fieldset{margin-top:10px}
.autoupgradeSteps div {  line-height: 30px; }
.upgradestep { margin-right: 5px;padding-left: 10px; padding-right: 5px;}
#upgradeNow.stepok, .autoupgradeSteps a.stepok { background-image: url("../img/admin/enabled.gif");background-position: left center;background-repeat: no-repeat;padding-left: 15px;}
#upgradeNow {-moz-border-bottom-colors: none;-moz-border-image: none;-moz-border-left-colors: none;-moz-border-right-colors: none;-moz-border-top-colors: none;border-color: #FFF6D3 #DFD5AF #DFD5AF #FFF6D3;border-right: 1px solid #DFD5AF;border-style: solid;border-width: 1px;color: #268CCD;font-size: medium;padding: 5px;}
.button-autoupgrade {-moz-border-bottom-colors: none;-moz-border-image: none;-moz-border-left-colors: none;-moz-border-right-colors: none;-moz-border-top-colors: none;border-color: #FFF6D3 #DFD5AF #DFD5AF #FFF6D3;border-right: 1px solid #DFD5AF;border-style: solid;border-width: 1px;color: #268CCD;display:inline-block;font-size: medium;margin:10px 0;padding: 5px;}
.processing {border:2px outset grey;margin-top:1px;overflow: auto;}
#infoStep {height:100px;width:300px}
#infoError {height:100px;width:550px}
#quickInfo {height:200px}
#upgradeResultCheck{ padding-left:20px;}
#checkPrestaShopFilesVersion, #checkPrestaShopModifiedFiles{margin-bottom:20px;}
#changedList ul{list-style-type:circle}
.changedFileList {margin-left:20px; padding-left:5px;}
.changedNotice li{color:grey;}
.changedImportant li{color:red;font-weight:bold}
.upgradeDbError{background-color:#FEEFB3}
.upgradeDbOk{background-color:#DFF2BF}
.small_label{font-weight:normal;width:300px;float:none;text-align:left;padding:0}
.blocOneClickUpgrade{width:530px;float:left}
.ocu-feature-list{margin:0;padding:0;list-style:none}
.ocu-feature-list li{background:url(../img/admin/enabled.gif) no-repeat; padding-left:20px;margin:0;}
</style>';
        $this->_html .= '
		<h1>' . $this->l('1-click Upgrade') . '</h1>
		<fieldset id="informationBlock" class="information" style="float: left; width: 30%;">
			<legend>' . $this->l('Welcome!') . '</legend>
			<p>' . $this->l('With the PrestaShop 1-click upgrade module, upgrading your store to the latest version available has never been easier!') . '<br /><br />
			<img src="../img/admin/warning.gif" alt=""/><strong>' . $this->l('This module is still in a "beta" version.') . '</strong><br /><br /><span style="color: #CC0000; font-weight: bold;">' . $this->l('Please always perform a full manual backup of your files and database before starting any upgrade.') . '</span><br />' . $this->l('Double-check the integrity of your backup and that you can easily manually roll-back if necessary.') . '<br />' . $this->l('If you don\'t know how to proceed, ask your hosting provider.') . '</p>			
		</fieldset>';
        /* Make sure the user has configured the upgrade options, or set default values */
        $configuration_keys = array('PS_AUTOUP_KEEP_DEFAULT_THEME' => 0, 'PS_AUTOUP_KEEP_MAILS' => 0, 'PS_AUTOUP_CUSTOM_MOD_DESACT' => 1, 'PS_AUTOUP_MANUAL_MODE' => 0, 'PS_AUTOUP_PERFORMANCE' => 1, 'PS_DISPLAY_ERRORS' => 0);
        foreach ($configuration_keys as $k => $default_value) {
            if (Configuration::get($k) == '') {
                Configuration::updateValue($k, $default_value);
            }
        }
        /* Checks/requirements and "Upgrade PrestaShop now" blocks */
        $this->_displayCurrentConfiguration();
        $this->_html .= '<div class="clear"></div>';
        $this->_displayBlockUpgradeButton();
        $this->_displayComparisonBlock();
        $this->_displayBlockActivityLog();
        $this->_displayRollbackForm();
        $this->_html .= '<br/>';
        $this->_html .= '<form action="' . $currentIndex . '&customSubmitAutoUpgrade=1&token=' . $this->token . '"
			method="post" enctype="multipart/form-data">';
        $this->_displayForm('backupOptions', $this->_fieldsBackupOptions, '<a href="#" name="backup-options" id="backup-options">' . $this->l('Backup Options') . '</a>', '', 'database_gear');
        $this->_displayForm('upgradeOptions', $this->_fieldsUpgradeOptions, '<a href="#" name="upgrade-options" id="upgrade-options">' . $this->l('Upgrade Options') . '</a>', '', 'prefs');
        $this->_html .= '</form>';
        $this->_html .= '<script type="text/javascript" src="' . __PS_BASE_URI__ . 'modules/autoupgrade/jquery.xml2json.js"></script>';
        $this->_html .= '<script type="text/javascript">' . $this->_getJsInit() . '</script>';
        echo $this->_html;
    }