Jump to content

Recommended Posts

I'm trying to move my PrestaShop store from one domain to another. So far so good but I have these errors when I try and login to the admin area:

 

Strict Standards: define() [function.define]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home4/posimpac/public_html/config/config.inc.php on line 105

 

Notice: Constant __PS_BASE_URI__ already defined in /home4/posimpac/public_html/config/config.inc.php on line 105 Notice: Undefined index: AdminHomeControllerCore in /home4/posimpac/public_html/classes/Autoload.php on line 115

 

Warning: require(/home4/posimpac/public_html/) [function.require]: failed to open stream: No such device in /home4/posimpac/public_html/classes/Autoload.php on line 115

 

Fatal error: require() [function.require]: Failed opening required '/home4/posimpac/public_html/' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home4/posimpac/public_html/classes/Autoload.php on line 115

 

I'm more concerned about the Fatal Error above this text. What does this mean and how do I fix it? I believe this is what's preventing me from logging in to the admin area.

Edited by zchristianl (see edit history)
Link to comment
Share on other sites

hello

does the file mentioned in error code exist?

remember that unix systems are case sensitive, it means that autoload.php isn't the same as Autoload.php

Yeah the file is correct. The A should be capital in Autoload.php.

 

Lines 112-116 State

 

    }

        // Call directly ProductCore, ShopCore class

        else

            require($this->root_dir.$this->index[$classname]);

    }

Link to comment
Share on other sites

Wow PrestaShop was NOT built to migrate. I played around with it and got these errors

 

 

Notice: Undefined index: AdminHomeControllerCore in /home4/posimpac/public_html/classes/Autoload.php on line 115

Warning: require(/home4/posimpac/public_html/) [function.require]: failed to open stream: No such device in /home4/posimpac/public_html/classes/Autoload.php on line 115

Fatal error: require() [function.require]: Failed opening required '/home4/posimpac/public_html/' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home4/posimpac/public_html/classes/Autoload.php on line 115

 

 

Here is my full Autoload.php

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* 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 <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

/**
 * @since 1.5
 */
class Autoload
{
	/**
	 * File where classes index is stored
	 */
	const INDEX_FILE = 'cache/class_index.php';

	/**
	 * @var Autoload
	 */
	protected static $instance;

	/**
	 * @var string Root directory
	 */
	protected $root_dir;

	/**
	 *  @var array array('classname' => 'path/to/override', 'classnamecore' => 'path/to/class/core')
	 */
	public $index = array();

	public $_include_override_path = true;

	protected function __construct()
	{
		$this->root_dir = dirname(dirname(__FILE__)).'/';
		if (file_exists($this->root_dir.Autoload::INDEX_FILE))
			$this->index = include($this->root_dir.Autoload::INDEX_FILE);
		else
			$this->generateIndex();
	}

	/**
	 * Get instance of autoload (singleton)
	 *
	 * @return Autoload
	 */
	public static function getInstance()
	{
		if (!Autoload::$instance)
			Autoload::$instance = new Autoload();

		return Autoload::$instance;
	}

	/**
	 * Retrieve informations about a class in classes index and load it
	 *
	 * @param string $classname
	 */
	public function load($classname)
	{
		// Smarty uses its own autoloader, so we exclude all Smarty classes
		if (strpos(strtolower($classname), 'smarty_') === 0)
			return;

		// regenerate the class index if the requested file doesn't exists
		if ((isset($this->index[$classname]) && $this->index[$classname] && !is_file($this->root_dir.$this->index[$classname]))
			|| (isset($this->index[$classname.'Core']) && $this->index[$classname.'Core'] && !is_file($this->root_dir.$this->index[$classname.'Core'])))
			$this->generateIndex();

		// If $classname has not core suffix (E.g. Shop, Product)
		if (substr($classname, -4) != 'Core')
		{
			// If requested class does not exist, load associated core class
			if (isset($this->index[$classname]) && !$this->index[$classname])
			{
				require($this->root_dir.$this->index[$classname.'Core']);

				// Since the classname does not exists (we only have a classCore class), we have to emulate the declaration of this class
				$class_infos = new ReflectionClass($classname.'Core');
				eval(($class_infos->isAbstract() ? 'abstract ' : '').'class '.$classname.' extends '.$classname.'Core {}');
			}
			else
			{
				// request a non Core Class load the associated Core class if exists
				if (isset($this->index[$classname.'Core']))
					require_once($this->root_dir.$this->index[$classname.'Core']);
				if (isset($this->index[$classname]))
					require_once($this->root_dir.$this->index[$classname]);
			}
		}
		// Call directly ProductCore, ShopCore class
		else
			require($this->root_dir.$this->index[$classname]);
	}

	/**
	 * Generate classes index
	 */
	public function generateIndex()
	{
		$classes = array_merge(
			$this->getClassesFromDir('classes/'),
			$this->getClassesFromDir('controllers/')
		);

		if ($this->_include_override_path)
			$classes = array_merge(
				$classes,
				$this->getClassesFromDir('override/classes/'),
				$this->getClassesFromDir('override/controllers/')
			);

		ksort($classes);
		$content = '<?php return '.var_export($classes, true).'; ?>';

		// Write classes index on disc to cache it
		$filename = $this->root_dir.Autoload::INDEX_FILE;
		$filename_tmp = tempnam(dirname($filename), basename($filename.'.'));
		if ($filename_tmp !== false && file_put_contents($filename_tmp, $content, LOCK_EX) !== false)
		{
			if (!rename($filename_tmp, $filename))
				unlink($filename_tmp);
			else
				@chmod($filename, 0666);
		}
		// $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;
	}

	/**
	 * Retrieve recursively all classes in a directory and its subdirectories
	 *
	 * @param string $path Relativ path from root to the directory
	 * @return array
	 */
	protected function getClassesFromDir($path)
	{
		$classes = array();

		foreach (scandir($this->root_dir.$path) as $file)
		{
			if ($file[0] != '.')
			{
				if (is_dir($this->root_dir.$path.$file))
					$classes = array_merge($classes, $this->getClassesFromDir($path.$file.'/'));
				else if (substr($file, -4) == '.php')
				{
					$content = file_get_contents($this->root_dir.$path.$file);
			 		$pattern = '#\W((abstract\s+)?class|interface)\s+(?P<classname>'.basename($file, '.php').'(Core)?)'
			 					.'(\s+extends\s+[a-z][a-z0-9_]*)?(\s+implements\s+[a-z][a-z0-9_]*(\s*,\s*[a-z][a-z0-9_]*)*)?\s*\{#i';
			 		if (preg_match($pattern, $content, $m))
			 		{
			 			$classes[$m['classname']] = $path.$file;
						if (substr($m['classname'], -4) == 'Core')
							$classes[substr($m['classname'], 0, -4)] = '';
			 		}
				}
			}
		}

		return $classes;
	}

	public function getClassPath($classname)
	{
		return isset($this->index[$classname]) ? $this->index[$classname] : null;
	}
}

Link to comment
Share on other sites

Notice: Undefined index: AdminHomeControllerCore in /home4/posimpac/public_html/classes/Autoload.php on line 91

Warning: require(/home4/posimpac/public_html/) [function.require]: failed to open stream: No such device in /home4/posimpac/public_html/classes/Autoload.php on line 91

Fatal error: require() [function.require]: Failed opening required '/home4/posimpac/public_html/' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home4/posimpac/public_html/classes/Autoload.php on line 91

ok, so another possible solution, 

go to /cache/ directory (you will see it in root dir of your prestashop)

and remove class_index.php file (backup it first)

then refresh your store

what's goin on then?

 

I get the errors above:

Link to comment
Share on other sites

  • 1 year later...

I just did a new store and used the backup restore tool. Screw this migration.

It was much easier to use that tool than mess with all this code.

 

Hello zchristianl! days ago I have the same problem as you, I can not see my site and access the administration panel after having changed my prestashop server and domain ... you tell me that solution found at the end ???  You created throughout the store again .. and what files you imported? I have a backup of the entire database and all of my previous ftp site.

 

Please wait for your answer !!

Thanks

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...