log() public method

public log ( $msg, $continue = false )
Beispiel #1
0
if (PHP_SAPI === 'cli') {
    $cwd = getcwd();
    parse_str(implode('&', array_slice($argv, 1)), $_GET);
    $sourceDir = !empty($_GET['s']) ? $_GET['s'] : "{$cwd}/source";
    $mage1Dir = !empty($_GET['m']) ? $_GET['m'] : "{$cwd}/../magento";
    $outputDir = !empty($_GET['o']) ? $_GET['o'] : "{$cwd}/../magento2/app/code";
} else {
    $sourceDir = 'source';
    $mage1Dir = '../magento';
    $outputDir = '../magento2/app/code';
    echo "<pre>";
}
include_once __DIR__ . '/SimpleDOM.php';
$converter = new ConvertM1M2($sourceDir, $mage1Dir, $outputDir);
$converter->convertAllExtensions();
$converter->log('ALL DONE')->log('');
die;
class ConvertM1M2
{
    protected $_env = [];
    protected $_fileCache = [];
    protected $_classFileCache = [];
    protected $_aliases = [];
    protected $_layouts = [];
    protected $_schemas = ['@XSI' => 'http://www.w3.org/2001/XMLSchema-instance', '@Framework/' => '../../../../../lib/internal/Magento/Framework/', '@Magento/' => '../../../Magento/'];
    const OBJ_MGR = '\\Magento\\Framework\\App\\ObjectManager::getInstance()->get';
    // Sources: http://mage2.ru, https://wiki.magento.com/display/MAGE2DOC/Class+Mage
    protected $_replace = ['classes' => ['Mage_Core_Helper_Abstract' => 'Magento_Framework_App_Helper_AbstractHelper', 'Mage_Core_Model_Abstract' => 'Magento_Framework_Model_AbstractModel', 'Mage_Core_Model_Mysql4_Abstract' => 'Magento_Framework_Model_Resource_Db_AbstractDb', 'Mage_Core_Block_Abstract' => 'Magento_Framework_View_Element_AbstractBlock', 'Mage_Core_Block_Template' => 'Magento_Framework_View_Element_Template', 'Mage_Core_Controller_Front_Action' => 'Magento_Framework_App_Action_Action', 'Mage_Adminhtml_Controller_Action' => 'Magento_Backend_App_Action', 'Mage_Adminhtml_' => 'Magento_Backend_', 'Mage_Admin_' => 'Magento_Backend_', 'Mage_Core_' => 'Magento_Framework_', 'Mage_Page_' => 'Magento_Framework_', 'Mage_' => 'Magento_', 'Varien_Object' => 'Magento_Framework_DataObject', 'Varien_Io_' => 'Magento_Framework_Filesystem_Io_', 'Varien_' => 'Magento_Framework_', '_Mysql4_' => '_Resource_'], 'classes_regex' => ['#_([A-Za-z0-9]+)_Abstract([^A-Z])#' => '_\\1_Abstract\\1\\2'], 'code' => ['Mage_Core_Model_Locale::DEFAULT_LOCALE' => '\\Magento\\Framework\\Locale\\Resolver::DEFAULT_LOCALE', 'Mage_Core_Model_Translate::CACHE_TAG' => '\\Magento\\Framework\\App\\Cache\\Type::CACHE_TAG', 'Mage::log(' => self::OBJ_MGR . '(\'Psr\\Log\\LoggerInterface\')->log(', 'Mage::logException(' => self::OBJ_MGR . '(\'Psr\\Log\\LoggerInterface\')->error(', 'Mage::dispatchEvent(' => self::OBJ_MGR . '(\'Magento\\Framework\\Event\\ManagerInterface\')->dispatch(', 'Mage::app()->getRequest()' => self::OBJ_MGR . '(\'Magento\\Framework\\App\\RequestInterface\')', 'Mage::app()->getLocale()->getLocaleCode()' => self::OBJ_MGR . '(\'Magento\\Framework\\Locale\\Resolver\')->getLocale()', 'Mage::app()->getStore(' => self::OBJ_MGR . '(\'Magento\\Store\\Model\\StoreManagerInterface\')->getStore(', 'Mage::app()->getCacheInstance()->canUse(' => self::OBJ_MGR . '(\'Magento\\Framework\\App\\Cache\\StateInterface\')->isEnabled(', 'Mage::app()->getCacheInstance()' => self::OBJ_MGR . '(\'Magento\\Framework\\App\\CacheInterface\')', 'Mage::getConfig()->getModuleDir(' => self::OBJ_MGR . '(\'Magento\\Framework\\Module\\Dir\\Reader\')->getModuleDir(', 'Mage::getStoreConfig(' => self::OBJ_MGR . '(\'Magento\\Framework\\App\\Config\\ScopeConfigInterface\')->getValue(', 'Mage::getStoreConfigFlag(' => self::OBJ_MGR . '(\'Magento\\Framework\\App\\Config\\ScopeConfigInterface\')->isSetFlag(', 'Mage::getDesign()' => self::OBJ_MGR . '(\'Magento\\Framework\\View\\DesignInterface\')', "Mage::helper('core/url')->getCurrentUrl()" => self::OBJ_MGR . '(\'Magento\\Framework\\UrlInterface\')->getCurrentUrl()', "Mage::getBaseUrl(" => self::OBJ_MGR . '(\'Magento\\Framework\\UrlInterface\')->getBaseUrl(', "Mage::getBaseDir(" => self::OBJ_MGR . '(\'Magento\\Framework\\Filesystem\')->getDirPath(', "Mage::getSingleton('admin/session')->isAllowed(" => self::OBJ_MGR . '(\'Magento\\Backend\\Model\\Auth\\Session\')->isAllowed('], 'code_regex' => ['#(Mage::helper\\([\'"][A-Za-z0-9/_]+[\'"]\\)|\\$this)->__\\(#' => '__(', "#Mage::(registry|register|unregister)\\(#" => self::OBJ_MGR . '(\'Magento\\Framework\\Registry\')->\\1('], 'acl_keys' => ['admin' => 'Magento_Backend::admin', 'admin/sales' => 'Magento_Sales:sales', 'admin/reports' => 'Magento_Reports:report', 'admin/system' => 'Magento_Backend::stores', 'admin/system/config' => 'Magento_Backend::stores_settings'], 'menu' => ['sales' => 'Magento_Sales::sales', 'report' => 'Magento_Reports:report']];
    public function __construct($rootDir, $mageDir, $outputDir)
    {
        $this->_env['source_dir'] = str_replace('\\', '/', $rootDir);
Beispiel #2
0
    $mage2Dir = !empty($_GET['o']) ? $_GET['o'] : "{$cwd}/../magento2";
    $stage = !empty($_GET['a']) ? (int) $_GET['a'] : 1;
} else {
    $sourceDir = 'source';
    $mage1Dir = '../magento';
    $mage2Dir = '../magento2';
    $stage = !empty($_GET['a']) ? (int) $_GET['a'] : 1;
    echo "<pre>";
}
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
$time = microtime(true);
include_once __DIR__ . '/SimpleDOM.php';
$converter = new ConvertM1M2($sourceDir, $mage1Dir, $mage2Dir);
$converter->convertAllExtensions($stage);
$converter->log('[SUCCESS] ALL DONE (' . (microtime(true) - $time) . ' sec)')->log('');
die;
class ConvertM1M2
{
    protected $_env = [];
    protected $_fileCache = [];
    protected $_classFileCache = [];
    protected $_aliases = ['blocks' => ['centinel' => 'Mage_Centinel']];
    protected $_layouts = [];
    protected $_schemas = ['@XSI' => 'http://www.w3.org/2001/XMLSchema-instance', '@Framework/' => '../../../../../lib/internal/Magento/Framework/', '@Magento/' => '../../../Magento/'];
    const OBJ_MGR = '\\Magento\\Framework\\App\\ObjectManager::getInstance()->get';
    // Sources: http://mage2.ru, https://wiki.magento.com/display/MAGE2DOC/Class+Mage
    protected $_replace;
    protected $_reservedWordsRe = '#^(
(a(bstract|nd|rray|s))|
(c(a(llable|se|tch)|l(ass|one)|on(st|tinue)))|