Exemplo n.º 1
0
 /**
  * Because install, upgrade and remove all are actually the exact same logic for themes.
  *
  * Returns false if nothing changed, else will return an array containing all changes.
  *
  * @param int $verbosity 0 for standard output, 1 for real-time, 2 for real-time verbose output.
  *
  * @return false | array
  * @throws \InstallerException
  */
 private function _performInstall($verbosity = 0)
 {
     $changed = [];
     $change = $this->_parseAssets(true, $verbosity);
     if ($change !== false) {
         $changed = array_merge($changed, $change);
     }
     $change = $this->_parseConfigs(true, $verbosity);
     if ($change !== false) {
         $changed = array_merge($changed, $change);
     }
     // Make sure the version is correct in the database.
     $c = new \ComponentModel('theme/' . $this->_name);
     $c->set('version', $this->_version);
     $c->save();
     return sizeof($changed) ? $changed : false;
 }
Exemplo n.º 2
0
	/**
	 * Set this component as enabled in the database.
	 */
	public function enable(){
		// If it's not installed already, it can't be disabled!
		if($this->isEnabled()) return false;

		$c = new ComponentModel($this->_name);
		$c->set('enabled', true);
		$c->save();
		$this->_enabled = true;

		$changed = array();

		$change = $this->_parseUserConfigs();
		if ($change !== false) $changed = array_merge($changed, $change);

		$change = $this->_parsePages();
		if ($change !== false) $changed = array_merge($changed, $change);

		// Do this when I actually have widgets to test.
		//$change = $this->_parseWidgets();
		//if ($change !== false) $changed = array_merge($changed, $change);

		if(sizeof($changed)){
			SystemLogModel::LogInfoEvent('/updater/component/enable', 'Component ' . $this->getName() . ' enabled successfully!', implode("\n", $changed));
		}

		// Ensure that the core component cache is purged too!
		\Core\Cache::Delete('core-components');

		return (sizeof($changed)) ? $changed : false;
	}