Backend\Modules\Extensions\Engine\Model::isThemeInstalled PHP Method

isThemeInstalled() public static method

Checks if a theme is already installed.
public static isThemeInstalled ( string $theme ) : boolean
$theme string
return boolean
    public static function isThemeInstalled($theme)
    {
        return (bool) BackendModeL::getContainer()->get('database')->getVar('SELECT 1
             FROM themes_templates
             WHERE theme = ?
             LIMIT 1', array($theme));
    }

Usage Example

Example #1
0
 /**
  * Validate if the theme can be installed.
  */
 private function validateInstall()
 {
     // already installed
     if (BackendExtensionsModel::isThemeInstalled($this->currentTheme)) {
         $this->redirect(BackendModel::createURLForAction('Themes') . '&error=already-installed&var=' . $this->currentTheme);
     }
     // no information file present
     if (!is_file(FRONTEND_PATH . '/Themes/' . $this->currentTheme . '/info.xml')) {
         $this->redirect(BackendModel::createURLForAction('Themes') . '&error=no-information-file&var=' . $this->currentTheme);
     }
 }
All Usage Examples Of Backend\Modules\Extensions\Engine\Model::isThemeInstalled