/**
  * Try to create and delete some folders to check if moving images to new file system will be possible
  *
  * @return boolean success
  */
 public static function testFileSystem()
 {
     $safe_mode = Tools::getSafeModeStatus();
     if ($safe_mode) {
         return false;
     }
     $folder1 = _PS_PROD_IMG_DIR_ . 'testfilesystem/';
     $test_folder = $folder1 . 'testsubfolder/';
     // check if folders are already existing from previous failed test
     if (file_exists($test_folder)) {
         @rmdir($test_folder);
         @rmdir($folder1);
     }
     if (file_exists($test_folder)) {
         return false;
     }
     @mkdir($test_folder, self::$access_rights, true);
     @chmod($test_folder, self::$access_rights);
     if (!is_writeable($test_folder)) {
         return false;
     }
     @rmdir($test_folder);
     @rmdir($folder1);
     if (file_exists($folder1)) {
         return false;
     }
     return true;
 }
Example #2
0
 public function process()
 {
     if (file_exists(_PS_ROOT_DIR_ . '/' . self::SETTINGS_FILE)) {
         require_once _PS_ROOT_DIR_ . '/' . self::SETTINGS_FILE;
     }
     if (!$this->session->process_validated) {
         $this->session->process_validated = array();
     }
     if (Tools::getValue('generateSettingsFile')) {
         $this->processGenerateSettingsFile();
     } elseif (Tools::getValue('installDatabase') && !empty($this->session->process_validated['generateSettingsFile'])) {
         $this->processInstallDatabase();
     } elseif (Tools::getValue('installDefaultData')) {
         $this->processInstallDefaultData();
     } elseif (Tools::getValue('populateDatabase') && !empty($this->session->process_validated['installDatabase'])) {
         $this->processPopulateDatabase();
     } elseif (Tools::getValue('configureShop') && !empty($this->session->process_validated['populateDatabase'])) {
         $this->processConfigureShop();
     } elseif (Tools::getValue('installFixtures') && !empty($this->session->process_validated['configureShop'])) {
         $this->processInstallFixtures();
     } elseif (Tools::getValue('installModules') && (!empty($this->session->process_validated['installFixtures']) || $this->session->install_type != 'full')) {
         $this->processInstallModules();
     } elseif (Tools::getValue('installModulesAddons') && !empty($this->session->process_validated['installModules'])) {
         $this->processInstallAddonsModules();
     } elseif (Tools::getValue('installTheme') && !empty($this->session->process_validated['installModulesAddons'])) {
         $this->processInstallTheme();
     } elseif (Tools::getValue('sendEmail') && !empty($this->session->process_validated['installTheme'])) {
         $this->processSendEmail();
     } else {
         // With no parameters, we consider that we are doing a new install, so session where the last process step
         // was stored can be cleaned
         if (Tools::getValue('restart')) {
             $this->session->process_validated = array();
             $this->session->database_clear = true;
             if (Tools::getSafeModeStatus()) {
                 $this->session->safe_mode = true;
             }
         } elseif (!Tools::getValue('submitNext')) {
             $this->session->step = 'configure';
             $this->session->last_step = 'configure';
             Tools::redirect('index.php');
         }
     }
 }
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
define('_PS_SMARTY_DIR_', _PS_TOOL_DIR_ . 'smarty/');
require_once _PS_SMARTY_DIR_ . 'Smarty.class.php';
global $smarty;
$smarty = new Smarty();
$smarty->setCompileDir(_PS_CACHE_DIR_ . 'smarty/compile');
$smarty->setCacheDir(_PS_CACHE_DIR_ . 'smarty/cache');
if (!Tools::getSafeModeStatus()) {
    $smarty->use_sub_dirs = true;
}
$smarty->setConfigDir(_PS_SMARTY_DIR_ . 'configs');
$smarty->caching = false;
$smarty->force_compile = Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_FORCE_COMPILE_ ? true : false;
$smarty->compile_check = Configuration::get('PS_SMARTY_FORCE_COMPILE') >= _PS_SMARTY_CHECK_COMPILE_ ? true : false;
/* Use this constant if you want to load smarty without all PrestaShop functions */
if (defined('_PS_SMARTY_FAST_LOAD_') && _PS_SMARTY_FAST_LOAD_) {
    return;
}
if (defined('_PS_ADMIN_DIR_')) {
    require_once dirname(__FILE__) . '/smartyadmin.config.inc.php';
} else {
    require_once dirname(__FILE__) . '/smartyfront.config.inc.php';
}
 /**
  * Init display for move images block
  */
 public function initMoveImages()
 {
     $this->context->smarty->assign(array('safe_mode' => Tools::getSafeModeStatus(), 'link_ppreferences' => 'index.php?tab=AdminPPreferences&token=' . Tools::getAdminTokenLite('AdminPPreferences') . '#PS_LEGACY_IMAGES_on'));
 }