// remove deprecated PS_ADMIN_DIR by _PS_ADMIN_DIR_

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8666 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-09-20 15:53:57 +00:00
parent b9e7daf0b7
commit b45dd02452
79 changed files with 339 additions and 339 deletions
+1 -1
View File
@@ -488,7 +488,7 @@ class AdminPreferences extends AdminTab
if (get_class($this) == 'Adminemails')
echo '<script type="text/javascript">if (getE(\'PS_MAIL_METHOD2_on\').checked) getE(\'smtp\').style.display = \'block\'; else getE(\'smtp\').style.display = \'none\';</script></div>';
if (!is_writable(PS_ADMIN_DIR.'/../config/settings.inc.php') AND $name == 'themes')
if (!is_writable(_PS_ADMIN_DIR_.'/../config/settings.inc.php') AND $name == 'themes')
echo '<p><img src="../img/admin/warning.gif" alt="" /> '.$this->l('if you change the theme, the settings.inc.php file must be writable (CHMOD 755 / 777)').'</p>';
echo ' <div align="center" style="margin-top: 20px;">
+2 -2
View File
@@ -390,7 +390,7 @@ abstract class AdminSelfTab
if (get_class($this) == 'Adminemails')
echo '<script type="text/javascript">if (getE(\'PS_MAIL_METHOD2_on\').checked) getE(\'smtp\').style.display = \'block\'; else getE(\'smtp\').style.display = \'none\';</script></div>';
if (!is_writable(PS_ADMIN_DIR.'/../config/settings.inc.php') AND $name == 'themes')
if (!is_writable(_PS_ADMIN_DIR_.'/../config/settings.inc.php') AND $name == 'themes')
echo '<p><img src="../img/admin/warning.gif" alt="" /> '.$this->l('if you change the theme, the settings.inc.php file must be writable (CHMOD 755 / 777)').'</p>';
echo ' <div align="center" style="margin-top: 20px;">
@@ -550,7 +550,7 @@ abstract class AdminSelfTab
$classname = 'Admin'.$subtab;
if ($module = Db::getInstance()->getValue('SELECT `module` FROM `'._DB_PREFIX_.'tab` WHERE `class_name` = \''.pSQL($classname).'\'') AND file_exists(_PS_MODULE_DIR_.'/'.$module.'/'.$classname.'.php'))
include_once(_PS_MODULE_DIR_.'/'.$module.'/'.$classname.'.php');
elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$classname.'.php'))
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$classname.'.php'))
include_once('tabs/'.$classname.'.php');
if (!isset($this->_includeObj[$key]))
$this->_includeObj[$key] = new $classname;
+62 -62
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if(!defined('_PS_ADMIN_DIR_'))
define('_PS_ADMIN_DIR_',PS_ADMIN_DIR);
define('_PS_ADMIN_DIR_', _PS_ADMIN_DIR_);
if(!defined('_PS_USE_SQL_SLAVE_'))
define('_PS_USE_SQL_SLAVE_',false);
@@ -44,7 +44,7 @@ if(empty($_POST['action']) OR !in_array($_POST['action'],array('upgradeDb')))
require_once(dirname(__FILE__).'/AdminSelfTab.php');
require_once(dirname(__FILE__).'/SelfModule.php');
// Add Upgrader class
// Add Upgrader class
if(!version_compare(_PS_VERSION_,'1.4.5.0','<') AND file_exists(_PS_ROOT_DIR_.'/classes/Upgrader.php'))
require_once(_PS_ROOT_DIR_.'/classes/Upgrader.php');
else
@@ -70,10 +70,10 @@ class AdminSelfUpgrade extends AdminSelfTab
public $ajax = false;
public $nextResponseType = 'json'; // json, xml
public $next = 'N/A';
public $upgrader = null;
public $standalone = true;
/**
* set to false if the current step is a loop
*
@@ -102,12 +102,12 @@ class AdminSelfUpgrade extends AdminSelfTab
'backupDbFilename',
'backupFilesFilename',
);
public $autoupgradePath = null;
/**
* autoupgradeDir
*
* autoupgradeDir
*
* @var string directory relative to admin dir
*/
public $autoupgradeDir = 'autoupgrade';
@@ -127,7 +127,7 @@ class AdminSelfUpgrade extends AdminSelfTab
private $backupFilesFilename = '';
private $backupDbFilename = '';
/**
* int loopBackupFiles : if your server has a low memory size, lower this value
* @TODO remove the static, add a const, and use it like this : min(AdminUpgrade::DEFAULT_LOOP_ADD_FILE_TO_ZIP,Configuration::get('LOOP_ADD_FILE_TO_ZIP');
@@ -170,7 +170,7 @@ class AdminSelfUpgrade extends AdminSelfTab
public function createCustomToken()
{
// ajax-mode for autoupgrade, we can't use the classic authentication
// so, we'll create a cookie in admin dir, based on cookie key
// so, we'll create a cookie in admin dir, based on cookie key
global $cookie;
$id_employee = $cookie->id_employee;
@@ -224,7 +224,7 @@ class AdminSelfUpgrade extends AdminSelfTab
/**
* _setFields function to set fields (only when we need it).
*
*
* @return void
*/
private function _setFields()
@@ -263,7 +263,7 @@ class AdminSelfUpgrade extends AdminSelfTab
);
}
}
public function configOk()
{
$allowed = (ConfigurationTest::test_fopen() && $this->rootWritable);
@@ -274,7 +274,7 @@ class AdminSelfUpgrade extends AdminSelfTab
}
/**
* isUpgradeAllowed checks if all server configuration is valid for upgrade
*
*
* @return void
*/
public function isUpgradeAllowed()
@@ -314,7 +314,7 @@ class AdminSelfUpgrade extends AdminSelfTab
if (!in_array($this->action,array('upgradeFile', 'upgradeDb', 'upgradeComplete','rollback','restoreFiles','restoreDb')))
{
// checkPSVersion will be not
// checkPSVersion will be not
$this->upgrader = new Upgrader();
$this->upgrader->checkPSVersion();
$this->nextParams['install_version'] = $this->upgrader->version_num;
@@ -333,7 +333,7 @@ $this->standalone = true;
}
else
$this->useSvn = false;
// If not exists in this sessions, "create"
// session handling : from current to next params
@@ -361,7 +361,7 @@ $this->standalone = true;
$this->backupDbFilename = Configuration::get('UPGRADER_BACKUPDB_FILENAME');
if(!file_exists($this->backupDbFilename))
{
// If not exists, the filename is generated by Backup.php
// If not exists, the filename is generated by Backup.php
$this->backupDbFilename = '';
Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $this->backupDbFilename);
}
@@ -402,7 +402,7 @@ $this->standalone = true;
$this->manualMode = $this->currentParams['manualMode'];
$this->desactivateCustomModule = $this->currentParams['desactivateCustomModule'];
}
// We can add any file or directory in the exclude dir : theses files will be not removed or overwritten
// We can add any file or directory in the exclude dir : theses files will be not removed or overwritten
// @TODO cache should be ignored recursively, but we have to reconstruct it after upgrade
// - compiled from smarty
// - .svn
@@ -425,18 +425,18 @@ $this->standalone = true;
if ($this->dontBackupImages)
$this->backupIgnoreAbsoluteFiles[] = "/img";
if ($this->keepDefaultTheme)
$this->excludeAbsoluteFilesFromUpgrade[] = "/themes/prestashop";
if ($this->keepTrad)
$this->excludeFilesFromUpgrade[] = "translations";
}
/**
* getFilePath return the path to the zipfile containing prestashop.
*
*
* @return void
*/
private function getFilePath()
@@ -594,13 +594,13 @@ $this->standalone = true;
if ($file[0] != '.')
{
$fullPath = $dir.DIRECTORY_SEPARATOR.$file;
if (!$this->_skipFile($file, $fullPath,'backup'))
{
if (is_dir($fullPath))
$this->_listBackupFiles($fullPath);
else
$list[] = $fullPath;
$list[] = $fullPath;
}
else
$list[] = $fullPath;
@@ -616,7 +616,7 @@ $this->standalone = true;
foreach ($allFiles as $file)
{
$fullPath = $dir.DIRECTORY_SEPARATOR.$file;
if (!$this->_skipFile($file, $fullPath, "upgrade"))
{
$list[] = $fullPath;
@@ -698,7 +698,7 @@ $this->standalone = true;
@ini_set('memory_limit','128M');
}
require_once($this->prodRootDir.'/config/autoload.php');
/* Redefine REQUEST_URI if empty (on some webservers...) */
if (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '')
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
@@ -753,7 +753,7 @@ $this->standalone = true;
case 'doUpgrade' :
require_once(INSTALL_PATH.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'doUpgrade.php');
break;
case 'getVersionFromDb' :
require_once(INSTALL_PATH.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'getVersionFromDb.php');
break;
@@ -913,7 +913,7 @@ $this->standalone = true;
/**
* ajaxProcessRestoreFiles restore the previously saved files.
*
*
* @return boolean true if succeed
*/
public function ajaxProcessRestoreFiles()
@@ -1015,7 +1015,7 @@ $this->standalone = true;
// @TODO need to check if a ";" in description could block that (I suppose it can at the end of a line)
preg_match_all('/(.*;)[\n\r]+/Usm', $content, $requests);
/* @TODO maybe improve regex pattern ... */
$db = Db::getInstance();
$db = Db::getInstance();
if (count($requests[0])>0)
{
foreach ($requests[1] as $request)
@@ -1062,7 +1062,7 @@ $this->standalone = true;
if(!class_exists('MySQL',false))
eval('Class MySQL extends MySQLCore{}');
}
if(!class_exists('Validate',false))
{
require_once(_PS_ROOT_DIR_.'/classes/Validate.php');
@@ -1104,7 +1104,7 @@ $this->standalone = true;
if ($res)
{
$this->nextParams['backupDbFilename'] = $backup->id;
// We need to load configuration to use it ...
// We need to load configuration to use it ...
Configuration::loadConfiguration();
Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $backup->id);
@@ -1147,12 +1147,12 @@ $this->standalone = true;
//$current = crc32(file_get_contents($file));
//$file = $this->nextParams['filesForBackup'][0];
//$latestFile = str_replace(_PS_ROOT_DIR_,$this->latestRootDir,$file);
// if (file_exists($latestFile))
// $latest = crc32($latestFile);
// else
// $latest = '';
$zip = new ZipArchive();
if ($zip->open($this->backupFilesFilename, ZIPARCHIVE::CREATE))
{
@@ -1269,13 +1269,13 @@ $this->standalone = true;
return $resRemove;
}
public function ajaxProcessSvnCheckout()
{
$this->nextParams = $this->currentParams;
if ($this->useSvn){
$dest = $this->autoupgradePath . DIRECTORY_SEPARATOR . $this->svnDir;
$svnStatus = svn_status($dest);
if (is_array($svnStatus))
{
@@ -1363,7 +1363,7 @@ $this->standalone = true;
$this->nextParams[$v] = $this->$v;
$return['nextParams'] = $this->nextParams;
$return['nextParams']['typeResult'] = $this->nextResponseType;
$return['nextQuickInfo'] = $this->nextQuickInfo;
@@ -1383,14 +1383,14 @@ $this->standalone = true;
$this->_errors[] = Tools::displayError('This class depends of several files modified in 1.4.5.0 version and should not be used in an older version');
}
parent::displayConf();
}
public function ajaxPreProcess()
{
if (!empty($_POST['responseType']) AND $_POST['responseType'] == 'json')
header('Content-Type: application/json');
if(!empty($_POST['action']))
{
$action = $_POST['action'];
@@ -1424,10 +1424,10 @@ $this->standalone = true;
if(function_exists('apache_get_modules'))
{
static $apacheModuleList = null;
if (!is_array($apacheModuleList))
$apacheModuleList = apache_get_modules();
// we need strpos (example can be evasive20
foreach($apacheModuleList as $module)
{
@@ -1437,7 +1437,7 @@ $this->standalone = true;
}
else{
// If apache_get_modules does not exists,
// one solution should be parsing httpd.conf,
// one solution should be parsing httpd.conf,
// but we could simple parse phpinfo(INFO_MODULES) return string
ob_start();
phpinfo(INFO_MODULES);
@@ -1547,7 +1547,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
else
$srcRootWritable = '../img/admin/disabled.gif';
echo '<b>'.$this->l('Root directory status').' : </b>'.'<img src="'.$srcRootWritable.'" /> '.($this->rootWritable?$this->l('fully writable'):$this->l('not writable recursively')).'<br/><br/>';
if ($this->upgrader->needUpgrade)
{
if ($this->upgrader->autoupgrade)
@@ -1621,19 +1621,19 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
{
echo '<span class="button-autoupgrade upgradestep" >'.$this->l('Your shop is already up to date.').'</span> ';
}
echo '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
echo '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
<a class="button" href="index.php?tab=AdminSelfUpgrade&token='.Tools::getAdminToken('AdminSelfUpgrade'.(int)(Tab::getIdFromClassName(get_class($this))).(int)$cookie->id_employee).'&refreshCurrentVersion=1">'.$this->l('Please click to refresh').'</a>
</small>';
echo'</div>
<div id="currentlyProcessing" style="display:none;float:right"><h4>Currently processing <img id="pleaseWait" src="'.__PS_BASE_URI__.'img/loader.gif"/></h4>
<div id="infoStep" class="processing" style=height:50px;width:400px;" >'.$this->l('I\'m waiting for your command, sir').'</div>';
echo '</div>';
echo '</fieldset>';
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $this->manualMode)
{
@@ -1720,10 +1720,10 @@ echo '</script>';
<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');
@@ -1776,7 +1776,7 @@ function addQuickInfo(arrQuickInfo){
$("#quickInfo").show();
for(i=0;i<arrQuickInfo.length;i++)
$("#quickInfo").append(arrQuickInfo[i]+"<br/>");
$("#quickInfo").attr({ scrollTop: $("#quickInfo").attr("scrollHeight") });
}
}';
@@ -1800,11 +1800,11 @@ $(document).ready(function(){
// more convenient to have that param for handling success and error
var requestParams;
// set timeout to 5 minutes (download can be long)?
$.ajaxSetup({timeout:300000});
// prepare available button here, without params ?
prepareNextButton("#upgradeNow",firstTimeParams);
prepareNextButton("#rollback",firstTimeParams);
@@ -1845,7 +1845,7 @@ function handleXMLResult(xmlRet, previousParams)
// this will be used in after** javascript functions
resGlobal = $.xml2json(xmlRet);
switch(previousParams.upgradeDbStep)
switch(previousParams.upgradeDbStep)
{
case 0: // getVersionFromDb
result = "ok";
@@ -1886,7 +1886,7 @@ function handleXMLResult(xmlRet, previousParams)
.show("slow");
$("#dbCreateResultCheck")
.hide("slow");
// propose rollback if there is an error
if (confirm("An error happen\r\n'.$this->l('Do you want to rollback ?').'"))
resGlobal = {next:"rollback",nextParams:{typeResult:"json"},status:"error"};
@@ -1915,8 +1915,8 @@ function afterUpgradeComplete()
$("#infoStep").html("<h3>'.$this->l('Upgrade Complete ! ').'</h3>");
}
/**
* afterBackupDb display the button
*
* afterBackupDb display the button
*
*/
function afterBackupDb()
{
@@ -1999,7 +1999,7 @@ function doAjaxRequest(action, nextParams){
$("#"+action).addClass("done");
if (res.stepDone)
$("#"+action).addClass("stepok");
// if a function "after[action name]" exists, it should be called.
// This is used for enabling restore buttons for example
funcName = "after"+ucFirst(action);
@@ -2107,7 +2107,7 @@ function handleError(res)
{
$("#rollback").click();
}
}
}
';
@@ -2132,7 +2132,7 @@ $js.= '$(document).ready(function(){
$("#checkPrestaShopFilesVersion").append("<a id=\"toggleChangedList\" class=\"button\" href=\"\">'.$this->l('See or hide the list').'</a><br/>");
$("#checkPrestaShopFilesVersion").append("<div id=\"changedList\" style=\"display:none \">");
$("#changedList").html("<ul>");
$(answer.result).each(function(k,v){
$("#changedList ul").append("<li>"+v+"</li>");
@@ -2192,7 +2192,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
return true;
}
/**
* @desc extract a zip file to the given directory
* @return bool success
@@ -2230,7 +2230,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
return true;
}
}
private function _listArchivedFiles()
{
if (!empty($this->nextParams['backupFilesFilepath']))
@@ -2242,7 +2242,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
{
while ($entry=zip_read($zip))
$files[] = zip_entry_name($entry);
zip_close($zip);
}
}
@@ -2255,7 +2255,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
}
return false;
}
/**
* bool _skipFile : check whether a file is in backup or restore skip list
*
@@ -2282,7 +2282,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
case 'upgrade':
if (in_array($file, $this->excludeFilesFromUpgrade))
return true;
foreach ($this->excludeAbsoluteFilesFromUpgrade as $path)
if (strpos($fullpath, $rootpath.$path) !== false)
return true;
+1 -2
View File
@@ -44,7 +44,6 @@ if ( _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$_POST['dir'] !== realpath(_PS_ROOT_DIR_
die('not allowed');
define('_PS_ADMIN_DIR_', _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$_POST['dir']);
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility
//require(_PS_ADMIN_DIR_.'/functions.php');
include(AUTOUPGRADE_MODULE_DIR.'init.php');
@@ -56,7 +55,7 @@ $adminObj->ajax = true;
{
if ($adminObj->checkToken())
{
// the differences with index.php is here
// the differences with index.php is here
$adminObj->ajaxPreProcess();
$action = Tools14::getValue('action');
+9 -8
View File
@@ -1,4 +1,5 @@
<?php
class Autoupgrade extends Module
{
function __construct()
@@ -9,11 +10,11 @@ class Autoupgrade extends Module
if (!defined('_PS_ADMIN_DIR_'))
{
if (defined('PS_ADMIN_DIR'))
define('_PS_ADMIN_DIR_',PS_ADMIN_DIR);
if (defined('_PS_ADMIN_DIR_'))
define('_PS_ADMIN_DIR_', _PS_ADMIN_DIR_);
else
{
$this->_errors[] = $this->l('This version of PrestaShop cannot be upgraded : PS_ADMIN_DIR constant is missing');
$this->_errors[] = $this->l('This version of PrestaShop cannot be upgraded :_PS_ADMIN_DIR_ constant is missing');
$autoupgradeCanWork = false;
}
}
@@ -36,7 +37,7 @@ class Autoupgrade extends Module
$tab = new Tab($idTab);
$res &= $tab->delete();
}
$idTab = Tab::getIdFromClassName('AdminSelfUpgrade');
// Then we add AdminSelfUpgrade only if not exists
if (!$idTab)
@@ -58,11 +59,11 @@ class Autoupgrade extends Module
if(file_exists($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php'))
$res &= unlink($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php');
$path = dirname(__FILE__).'/';
$res &= copy($path.'ajax-upgradetab.php',$autoupgradeDir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
$res &= copy($path.'logo.gif',_PS_ROOT_DIR_. DIRECTORY_SEPARATOR . 'img/t/AdminSelfUpgrade.gif');
if (!$res
if (!$res
OR !Tab::getIdFromClassName('AdminSelfUpgrade')
OR !parent::install()
)
@@ -85,7 +86,7 @@ class Autoupgrade extends Module
}
$res &= unlink(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'tabs'.'AdminUpgrade.php');
}
if (file_exists(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'autoupgrade'.DIRECTORY_SEPARATOR.'ajax-upgradetab.php'))
$res &= @unlink(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'autoupgrade'.DIRECTORY_SEPARATOR.'ajax-upgradetab.php');
if (!$res OR !parent::uninstall())
+3 -3
View File
@@ -101,7 +101,7 @@ function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL)
foreach ($defines as $k => $value)
$content .= 'define(\''.$k.'\', \''.addslashes($value).'\');'."\n";
$content .= "\n?>";
if ($fd = @fopen(PS_ADMIN_DIR.'/../config/settings.inc.php', 'w'))
if ($fd = @fopen(_PS_ADMIN_DIR_.'/../config/settings.inc.php', 'w'))
{
fwrite($fd, $content);
fclose($fd);
@@ -254,8 +254,8 @@ function checkingTab($tab)
}
if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php'))
include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php');
elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$tab.'.php'))
include_once(PS_ADMIN_DIR.'/tabs/'.$tab.'.php');
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php'))
include_once(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php');
if (!class_exists($tab, false) OR !$row['id_tab'])
{