/** * Dump all tables * * @return string */ public function run() { $this->_currentVersion = 'v' . Craft::getVersion() . '.' . Craft::getBuild(); $result = $this->_processHeader(); foreach (craft()->db->getSchema()->getTables() as $tableName => $val) { $result .= $this->_processTable($tableName); } $result .= $this->_processConstraints(); $result .= $this->_processFooter(); $fileName = IOHelper::cleanFilename(Craft::getSiteName()) . '_' . gmdate('ymd_His') . '_' . $this->_currentVersion . '.sql'; $filePath = craft()->path->getDbBackupPath() . strtolower($fileName); IOHelper::writeToFile($filePath, $result); return $filePath; }
/** * Gets the widget's body HTML. * * @return string */ public function getBodyHtml() { $id = $this->model->id; $js = "new Craft.GetHelpWidget({$id});"; craft()->templates->includeJs($js); craft()->templates->includeJsResource('js/GetHelpWidget.js'); craft()->templates->includeTranslations('Message sent successfully.'); $message = "Enter your message here.\n\n" . "------------------------------\n\n" . 'Craft version: ' . Craft::t('{version} build {build}', array('version' => Craft::getVersion(), 'build' => Craft::getBuild())) . "\n" . 'Packages: ' . implode(', ', Craft::getPackages()); $plugins = craft()->plugins->getPlugins(); if ($plugins) { $pluginNames = array(); foreach ($plugins as $plugin) { $pluginNames[] = $plugin->getName() . ' (' . $plugin->getDeveloper() . ')'; } $message .= "\nPlugins: " . implode(', ', $pluginNames); } return craft()->templates->render('_components/widgets/GetHelp/body', array('message' => $message)); }
/** * Returns true is the build stored in craft_info is less than the minimum required build on the file system. * This effectively makes sure that a user cannot manually update past a manual breakpoint. * * @return bool */ public function isBreakpointUpdateNeeded() { // Only Craft has the concept of a breakpoint, not plugins. if ($this->isCraftDbUpdateNeeded()) { return Craft::getBuild() < CRAFT_MIN_BUILD_REQUIRED; } else { return false; } }
/** * Returns the installed Craft build. * * @return string */ public function getBuild() { return Craft::getBuild(); }