Exemplo n.º 1
0
 /**
  * Get translation codes
  *
  * @return array
  */
 public function getTranslationCodes()
 {
     return \Includes\Utils\ArrayManager::getObjectsArrayFieldValues($this->getTranslations()->toArray(), 'getCode');
 }
Exemplo n.º 2
0
 /**
  * The certain request handler
  *
  * @param integer $ttl Data TTL OPTIONAL
  *
  * @return boolean
  */
 public function checkAddonsKeys($ttl = self::TTL_LONG)
 {
     $repoModuleKey = \XLite\Core\Database::getRepo('\\XLite\\Model\\ModuleKey');
     $keys = array_unique(\Includes\Utils\ArrayManager::getObjectsArrayFieldValues($repoModuleKey->findAll(), 'getKeyValue', true));
     $result = $this->performActionWithTTL($ttl, static::ACTION_CHECK_ADDON_KEY, array(static::FIELD_KEY => $keys), false);
     if (static::TTL_NOT_EXPIRED !== $result) {
         $repoModule = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module');
         foreach ((array) $result as $key => $addonsInfo) {
             $repoModuleKey->deleteInBatch($repoModuleKey->findBy(array('keyValue' => $key)));
             foreach ($addonsInfo as $info) {
                 $module = $repoModule->findOneBy(array('author' => $info['author'], 'name' => $info['name']));
                 if ($module) {
                     $repoModuleKey->insert($info + array('keyValue' => $key));
                     // Clear cache for proper installation
                     \XLite\Core\Marketplace::getInstance()->clearActionCache(\XLite\Core\Marketplace::ACTION_GET_ADDONS_LIST);
                 } else {
                     // No module has been found
                 }
             }
         }
     }
     return (bool) $result;
 }
Exemplo n.º 3
0
 /**
  * The certain request handler
  *
  * @param integer $ttl Data TTL OPTIONAL
  *
  * @return boolean
  */
 public function checkAddonsKeys($ttl = null)
 {
     $repoModuleKey = \XLite\Core\Database::getRepo('\\XLite\\Model\\ModuleKey');
     $keys = array_unique(\Includes\Utils\ArrayManager::getObjectsArrayFieldValues($repoModuleKey->findAll(), 'getKeyValue', true));
     if (!empty($keys)) {
         $result = $this->performActionWithTTL($ttl, static::ACTION_CHECK_ADDON_KEY, array(static::FIELD_KEY => $keys), false);
     } else {
         $result = null;
     }
     if (static::TTL_NOT_EXPIRED !== $result) {
         $repoModule = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module');
         foreach ((array) $result as $key => $addonsInfo) {
             foreach ($addonsInfo as $info) {
                 if ('CDev' == $info['author'] && 'Core' == $info['name']) {
                     // Entity is core
                     $isValid = true;
                 } else {
                     // Entity is module. Search for existing module
                     $isValid = (bool) $repoModule->findOneBy(array('author' => $info['author'], 'name' => $info['name']));
                 }
                 // Search for existing module key
                 $keyModel = $repoModuleKey->findOneBy(array('keyValue' => $key, 'author' => $info['author'], 'name' => $info['name']));
                 if ($isValid) {
                     if ($keyModel) {
                         $repoModuleKey->update($keyModel, $info);
                     } else {
                         $repoModuleKey->insert($info + array('keyValue' => $key));
                     }
                     // Clear cache for proper installation
                     $this->clearActionCache(\XLite\Core\Marketplace::ACTION_GET_ADDONS_LIST);
                 } else {
                     // No module has been found
                     if ($keyModel) {
                         $repoModuleKey->delete($keyModel);
                     }
                 }
             }
         }
     }
     return (bool) $result;
 }
Exemplo n.º 4
0
 /**
  * Return list of error messages
  *
  * @return array
  */
 public function getErrorMessages()
 {
     if (!isset($this->errorMessages)) {
         $this->errorMessages = array();
         $freeSpaceError = $this->isFreeSpaceCheckAvailable() ? $this->checkDiskFreeSpace() : false;
         if (!$this->isUnpacked() && $freeSpaceError) {
             $this->errorMessages[self::CORE_IDENTIFIER] = array($freeSpaceError);
         }
         $this->errorMessages = array_merge($this->errorMessages, \Includes\Utils\ArrayManager::getObjectsArrayFieldValues($this->getEntries(), 'getErrorMessages'));
         $this->errorMessages = array_filter($this->errorMessages);
     }
     return $this->errorMessages;
 }
Exemplo n.º 5
0
 /**
  * Check if upgrade or update is available on Marketplace.
  *
  * @return boolean
  */
 public function isUpgradeEntryAvailable()
 {
     \XLite\Upgrade\Cell::getInstance()->clear();
     return (bool) array_filter(\Includes\Utils\ArrayManager::getObjectsArrayFieldValues(\XLite\Upgrade\Cell::getInstance()->getEntries(), 'isEnabled'));
 }