Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
commit
0e54bf0f76
3 files changed
+18
-17
No files matched your search
+9
-15
@@ -137,24 +137,18 @@ class Autoload
|
|||||||
|
|
||||||
// Write classes index on disc to cache it
|
// Write classes index on disc to cache it
|
||||||
$filename = $this->root_dir.Autoload::INDEX_FILE;
|
$filename = $this->root_dir.Autoload::INDEX_FILE;
|
||||||
if ((file_exists($filename) && !is_writable($filename)) || !is_writable(dirname($filename)))
|
$filename_tmp = tempnam(dirname($filename), basename($filename.'.'));
|
||||||
|
if ($filename_tmp !== false && file_put_contents($filename_tmp, $content, LOCK_EX) !== false)
|
||||||
{
|
{
|
||||||
header('HTTP/1.1 503 temporarily overloaded');
|
if (!rename($filename_tmp, $filename))
|
||||||
// Cannot use PrestaShopException in this context
|
unlink($filename_tmp);
|
||||||
die('/cache/class_index.php is not writable, please give write permissions (chmod 666) on this file.');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$filename_tmp = tempnam(dirname($filename), basename($filename.'.'));
|
|
||||||
if($filename_tmp !== FALSE and file_put_contents($filename_tmp, $content, LOCK_EX) !== FALSE)
|
|
||||||
{
|
|
||||||
@rename($filename_tmp, $filename);
|
|
||||||
@chmod($filename, 0666);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die.
|
@chmod($filename, 0666);
|
||||||
error_log('Cannot write temporary file '.$filename_tmp);
|
|
||||||
}
|
}
|
||||||
|
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die.
|
||||||
|
else
|
||||||
|
error_log('Cannot write temporary file '.$filename_tmp);
|
||||||
|
|
||||||
$this->index = $classes;
|
$this->index = $classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -390,6 +390,10 @@ class HookCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function exec($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true)
|
public static function exec($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true)
|
||||||
{
|
{
|
||||||
|
static $disable_non_native_modules = null;
|
||||||
|
if ($disable_non_native_modules === null)
|
||||||
|
$disable_non_native_modules = (bool)Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
|
||||||
|
|
||||||
// Check arguments validity
|
// Check arguments validity
|
||||||
if (($id_module && !is_numeric($id_module)) || !Validate::isHookName($hook_name))
|
if (($id_module && !is_numeric($id_module)) || !Validate::isHookName($hook_name))
|
||||||
throw new PrestaShopException('Invalid id_module or hook_name');
|
throw new PrestaShopException('Invalid id_module or hook_name');
|
||||||
@@ -419,7 +423,7 @@ class HookCore extends ObjectModel
|
|||||||
$altern = 0;
|
$altern = 0;
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if (!isset(Hook::$native_module))
|
if ($disable_non_native_modules && !isset(Hook::$native_module))
|
||||||
Hook::$native_module = Module::getNativeModuleList();
|
Hook::$native_module = Module::getNativeModuleList();
|
||||||
|
|
||||||
foreach ($module_list as $array)
|
foreach ($module_list as $array)
|
||||||
@@ -428,7 +432,7 @@ class HookCore extends ObjectModel
|
|||||||
if ($id_module && $id_module != $array['id_module'])
|
if ($id_module && $id_module != $array['id_module'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((bool)Configuration::get('PS_DISABLE_NON_NATIVE_MODULE') && !in_array($array['module'], self::$native_module))
|
if ((bool)$disable_non_native_modules && Hook::$native_module && count(Hook::$native_module) && !in_array($array['module'], self::$native_module))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!($moduleInstance = Module::getInstanceByName($array['module'])))
|
if (!($moduleInstance = Module::getInstanceByName($array['module'])))
|
||||||
|
|||||||
@@ -1296,6 +1296,9 @@ abstract class ModuleCore
|
|||||||
public static function getNativeModuleList()
|
public static function getNativeModuleList()
|
||||||
{
|
{
|
||||||
$module_list_xml = _PS_ROOT_DIR_.self::CACHE_FILE_MODULES_LIST;
|
$module_list_xml = _PS_ROOT_DIR_.self::CACHE_FILE_MODULES_LIST;
|
||||||
|
if (!file_exists($module_list_xml))
|
||||||
|
return false;
|
||||||
|
|
||||||
$native_modules = simplexml_load_file($module_list_xml);
|
$native_modules = simplexml_load_file($module_list_xml);
|
||||||
$native_modules = $native_modules->modules;
|
$native_modules = $native_modules->modules;
|
||||||
$modules = array();
|
$modules = array();
|
||||||
|
|||||||
Reference in new issue
Block a user