/** * testCreate * * @return void * @access public * @see ____func_see____ * @since 1.0.0 */ public function testGetSet() { \XLite\Core\TmpVars::getInstance()->test = 123; $this->assertEquals(123, \XLite\Core\TmpVars::getInstance()->test, 'test 1'); \XLite\Core\TmpVars::getInstance()->test = array(1, 2, 3); $this->assertEquals(array(1, 2, 3), \XLite\Core\TmpVars::getInstance()->test, 'test 2'); }
/** * Return update timestamp * * @return integer */ protected function getLastUpdateTimestamp() { $result = \XLite\Core\TmpVars::getInstance()->lowStockUpdateTimestamp; if (!isset($result)) { $result = LC_START_TIME; \XLite\Core\TmpVars::getInstance()->lowStockUpdateTimestamp = $result; } return $result; }
/** * Update low stock update timestamp * * @return void */ protected function updateLowStockUpdateTimestamp() { \XLite\Core\TmpVars::getInstance()->lowStockUpdateTimestamp = LC_START_TIME; }
/** * Clear saved data * * @return void */ protected function clearUpgradeCell() { \XLite\Core\TmpVars::getInstance()->{\XLite\Upgrade\Cell::CELL_NAME} = null; }
/** * Process current row * * @param string $mode Mode * * @return boolean */ public function processCurrentRow($mode) { $this->mode = $mode; $result = false; if ($this->isRowProcessingAllowed()) { if (0 === $this->file->key()) { $this->initialize(); } $rawRows = $this->collectRawRows(); $this->rowStartIndex = key($rawRows); if ($this->isHeaderRow($rawRows)) { $result = $this->processHeaderRow($rawRows); \XLite\Core\TmpVars::getInstance()->importHeadersSize = count(current($rawRows)); } else { $data = $this->assembleColumnsData($rawRows); if (\XLite\Core\TmpVars::getInstance()->importHeadersSize !== count(current($rawRows))) { $this->addWarning('CMN-INVALID-ROW-LENGTH'); } if (!empty($data)) { $this->currentRowData = $data; if ($this->isVerification()) { $result = $this->verifyData($data); } else { $result = $this->importData($data); } } else { $result = true; } } } return $result; }
/** * Set update timestamp * * @param integer $timestamp Timestamp * * @return void */ protected function setLastUpdateTimestamp($timestamp) { \XLite\Core\TmpVars::getInstance()->warningMessageLastTimestamp = $timestamp; }
/** * Check status changed * * @param array $status Current status * * @return boolean */ protected function isStatusChanged($status) { $result = false; $savedStatus = \XLite\Core\TmpVars::getInstance()->upgradeInfoStatus; if (!is_array($savedStatus) || !isset($savedStatus['status'])) { $result = true; } if ($savedStatus['status'] !== $status['status'] || $savedStatus['count'] !== $status['count']) { $result = true; } return $result; }
/** * Upload to PB SFTP Server, called from completed.tpl * * @return boolean */ public function uploadToPB() { $result = false; $generator = $this->getGenerator(); if ($generator) { $config = \XLite\Module\XC\PitneyBowes\Model\Shipping\Processor\PitneyBowes::getProcessorConfiguration(); $processor = new PitneyBowes\Logic\FileExchange\Processor($config); $result = $processor->submitCatalog($generator->getCatalogFiles(), $generator->getOptions()->differential); if ($result) { \XLite\Core\TmpVars::getInstance()->{\XLite\Module\XC\PitneyBowes\Core\Task\PitneyBowesCatalog::CELL_DIFF_EXTRACTION} = LC_START_TIME; if (!$generator->getOptions()->differential) { \XLite\Core\TmpVars::getInstance()->{\XLite\Module\XC\PitneyBowes\Core\Task\PitneyBowesCatalog::CELL_FULL_EXTRACTION} = LC_START_TIME; } } } return $result; }
/** * Protected constructor * * @return void */ protected function __construct() { parent::__construct(); // Upload addons info into the database \XLite\Core\Marketplace::getInstance()->saveAddonsList($this->getCacheTTL()); $coreVersionBeforeUpgrade = \XLite\Core\Config::getInstance()->Internal->coreVersionBeforeUpgrade; // WARNING! Do not change the order of the structure data. // The NEW information must be added to the TAIL of the structure strictly! list($entries, $isUpgraded, $disabledModulesHooks, $incompatibleModules, $preUpgradeWarningModules) = \XLite\Core\TmpVars::getInstance()->{self::CELL_NAME}; // Hack for the 5.1.2 and previous versions. // @see #BUG-537 for more details if ($coreVersionBeforeUpgrade && version_compare($coreVersionBeforeUpgrade, '5.1.2', '<=')) { list($entries, $incompatibleModules, $isUpgraded, $disabledModulesHooks, $preUpgradeWarningModules) = \XLite\Core\TmpVars::getInstance()->{self::CELL_NAME}; } if (is_array($entries)) { $this->entries = array_merge($this->entries, $entries); $this->incompatibleModules = $this->incompatibleModules + (array) $incompatibleModules; $this->disabledModulesHooks = $this->disabledModulesHooks + (array) $disabledModulesHooks; $this->preUpgradeWarningModules = $this->preUpgradeWarningModules + (array) $preUpgradeWarningModules; $this->setUpgraded(!empty($isUpgraded)); } else { $this->collectEntries(); } }
/** * Get container tag attributes * * @return array */ protected function getContainerTagAttributes() { $state = 'post-opened'; $tmpVarHash = \XLite\Core\TmpVars::getInstance()->{static::READ_MARK_KEY}; $realHash = \XLite\Core\Marketplace::getInstance()->unseenUpdatesHash(); if ($realHash !== $tmpVarHash) { \XLite\Core\TmpVars::getInstance()->{static::READ_MARK_KEY} = null; } elseif (!empty($tmpVarHash)) { $state = 'post-closed'; } return array('class' => array('upgrade-box', $state)); }
/** * Protected constructor * * @return void */ protected function __construct() { parent::__construct(); // Upload addons info into the database \XLite\Core\Marketplace::getInstance()->saveAddonsList($this->getCacheTTL()); list($entries, $incompatibleModules, $isUpgraded) = \XLite\Core\TmpVars::getInstance()->{self::CELL_NAME}; if (is_array($entries)) { $this->entries = array_merge($this->entries, $entries); $this->incompatibleModules = $this->incompatibleModules + (array) $incompatibleModules; $this->setUpgraded(!empty($isUpgraded)); } else { $this->collectEntries(); } }
/** * Check if its time to run diff catalog extraction * * @return boolean */ protected function shouldRunDiffExtraction() { $config = $this->getConfiguration(); $period = $config->diff_catalog_extraction * static::INT_1_HOUR; $lastRun = \XLite\Core\TmpVars::getInstance()->{static::CELL_DIFF_EXTRACTION}; return !$lastRun || $period && LC_START_TIME > $lastRun + $period; }
/** * Returns last read timestamp * * @return integer */ protected function getLastReadTimestamp() { return \XLite\Core\TmpVars::getInstance()->marketplaceMenuReadTimestamp; }
/** * Check banner is closed * * @return boolean */ protected function isBannerClosed() { $closedModuleBanners = \XLite\Core\TmpVars::getInstance()->closedModuleBanners ?: array(); return $this->isCanClose() && !empty($closedModuleBanners[$this->getModuleName()]); }
/** * Close module banner * * @return void */ protected function doActionCloseModuleBanner() { $moduleName = \XLite\Core\Request::getInstance()->module; $closedModuleBanners = \XLite\Core\TmpVars::getInstance()->closedModuleBanners ?: array(); $closedModuleBanners[$moduleName] = true; \XLite\Core\TmpVars::getInstance()->closedModuleBanners = $closedModuleBanners; print 'OK'; $this->setSuppressOutput(true); }