-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for issue #9:Error when using shell/indexer.php in Magento 1.7
Moved autoloader to a helper class. Extra check if autoloader is registered when creating Engine instance.
- Loading branch information
1 parent
e80a1bb
commit 745b37e
Showing
4 changed files
with
61 additions
and
33 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
app/code/community/JeroenVermeulen/Solarium/Helper/Autoloader.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/** | ||
* JeroenVermeulen_Solarium | ||
* | ||
* 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 | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this Module to | ||
* newer versions in the future. | ||
* | ||
* @category JeroenVermeulen | ||
* @package JeroenVermeulen_Solarium | ||
* @copyright Copyright (c) 2014 Jeroen Vermeulen (http://www.jeroenvermeulen.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
class JeroenVermeulen_Solarium_Helper_Autoloader extends Mage_Core_Helper_Abstract | ||
{ | ||
|
||
/** | ||
* Prepends our autoloader, so we can load the extra library classes when they are needed. | ||
*/ | ||
public function register() { | ||
$registryKey = 'JeroenVermeulen_Solarium_Autoloader_registered'; | ||
if ( ! Mage::registry( $registryKey ) ) { | ||
Mage::register( $registryKey, true ); | ||
spl_autoload_register( array( $this, 'load' ), true, true ); | ||
} | ||
} | ||
|
||
/** | ||
* This function can autoload classes starting with: | ||
* - Solarium | ||
* - Symfony\Component\EventDispatcher | ||
* | ||
* @param string $class | ||
*/ | ||
public static function load( $class ) { | ||
if ( preg_match( '#^(Solarium|Symfony\\\\Component\\\\EventDispatcher)\b#', $class ) ) { | ||
$phpFile = Mage::getBaseDir( 'lib' ) . DIRECTORY_SEPARATOR | ||
. str_replace( '\\', DIRECTORY_SEPARATOR, $class ) . '.php'; | ||
/** @noinspection PhpIncludeInspection */ | ||
require_once( $phpFile ); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters