function miau_colors($options) { $ary = miau_get_colors(); foreach ($ary as $color) { common::echoMessage($color); $char = substr($color, 0, 1); echo common::colorOutput(miau_cat(), $char) . PHP_EOL; } }
/** * Upgrade to a specific version of a module * @param float $specific e.g. '5.06' * @return boolean $res */ public function upgrade($specific = null) { // Only upgrade if module is installed if (!moduleloader::isInstalledModule($this->installInfo['NAME'])) { common::echoMessage("Notice: Can not upgrade. You will need to install module first"); return; } // Get specific version if (!isset($specific)) { $specific = $this->installInfo['VERSION']; } // Get current module version from registry $row = $this->getModuleDbInfo(); $current_version = $row['module_version']; // Same version. Return if ($current_version == $specific) { $this->confirm = "Module '" . $this->installInfo['NAME'] . "'. Version is '{$specific}'. No upgrade to perform"; return true; } // Get a list of SQL updates to perform $updates = $this->getSqlFileListOrdered($this->installInfo['NAME'], 'up'); // perform sql upgrade if (!empty($updates)) { foreach ($updates as $key => $val) { $possible_versions = ''; $version = substr($val, 0, -4); if ($version == $specific) { $version_exists = true; } else { $possible_versions .= "{$version} "; } } if (!isset($version_exists)) { $this->error = 'Module SQL ' . $this->installInfo['NAME'] . " "; $this->error .= 'does not have such a version. Possible version are: '; $this->error .= $possible_versions; } // perform SQL updates found in .sql files foreach ($updates as $key => $val) { $version = substr($val, 0, -4); if ($current_version < $version) { $this->executeSqlUpgrade($version); } } } // update registry $this->updateRegistry($specific, $row['id']); if ($specific > $current_version) { $this->confirm = "Module '" . $this->installInfo['NAME'] . "'. "; $this->confirm .= "Version '" . $specific . "' installed. "; $this->confirm .= "Upgraded from {$current_version}"; $this->confirm = common::colorOutput($this->confirm); return true; } else { $this->confirm = "Module '" . $this->installInfo['NAME'] . "'. Nothing to upgrade. Module version is still {$current_version}"; return true; } }