Ejemplo n.º 1
0
 /**
  * Konstruktor
  * @param string $filePath
  */
 public function __construct($filePath)
 {
     $this->db = \fpcm\classes\baseconfig::$fpcmDatabase;
     $this->isPg = $this->db->getDbtype() == 'pgsql' ? true : false;
     $this->colTypes = $this->db->getYaTDLDataTypes();
     include_once \fpcm\classes\loader::libGetFilePath('spyc', 'Spyc.php');
     $this->yamlArray = \Spyc::YAMLLoad($filePath);
 }
Ejemplo n.º 2
0
 /**
  * Inittiert Objekt mit Daten aus der Datenbank, sofern ID vergeben wurde
  */
 protected function init()
 {
     $data = $this->dbcon->fetch($this->dbcon->select($this->table, '*', "modkey " . $this->dbcon->dbLike() . " ?", array($this->modkey)));
     if (!$data) {
         return false;
     }
     $this->objExists = true;
     $this->isInstalled = true;
     foreach ($data as $key => $value) {
         $this->{$key} = $value;
     }
 }
Ejemplo n.º 3
0
 public function run($params = null)
 {
     $this->db = \fpcm\classes\baseconfig::$fpcmDatabase;
     $view = new \fpcm\model\view\module('nkorg/classicimporter', 'acp', 'main', '');
     $import = true;
     if ($this->db->count(\fpcm\classes\database::tableRoll) > 3) {
         $import = false;
     }
     if ($this->db->count(\fpcm\classes\database::tableAuthors) > 1) {
         $import = false;
     }
     if ($this->db->count(\fpcm\classes\database::tableCategories) > 1) {
         $import = false;
     }
     if ($this->db->count(\fpcm\classes\database::tableArticles) > 0) {
         $import = false;
     }
     if ($this->db->count(\fpcm\classes\database::tableComments) > 0) {
         $import = false;
     }
     if (!$import) {
         $view->addErrorMessage('FPCM_CLASSICIMPORTER_NOIMPORT');
     }
     $view->assign('doimport', $import);
     $view->assign('importActions', array('FPCM_CLASSICIMPORTER_IMPORT_ROLLS' => 'imports/rolls.php', 'FPCM_CLASSICIMPORTER_IMPORT_USERS' => 'imports/users.php', 'FPCM_CLASSICIMPORTER_IMPORT_CATEGORIES' => 'imports/categories.php', 'FPCM_CLASSICIMPORTER_IMPORT_IPS' => 'imports/ipadresses.php', 'FPCM_CLASSICIMPORTER_IMPORT_SMILEYS' => 'imports/smileys.php', 'FPCM_CLASSICIMPORTER_IMPORT_UPLAODS' => 'imports/uploads.php', 'FPCM_CLASSICIMPORTER_IMPORT_ARTICLES' => 'imports/articles.php', 'FPCM_CLASSICIMPORTER_IMPORT_CONFIG' => 'imports/config.php', 'FPCM_CLASSICIMPORTER_IMPORT_TEMPLATES' => 'imports/templates.php'));
     $view->addJsVars(array('fpcmClassicImporterOpenModule' => $this->lang->translate('FPCM_CLASSICIMPORTER_OPENMODULE'), 'fpcmClassicImporterArticleID' => $this->lang->translate('FPCM_CLASSICIMPORTER_IMPORT_ARTICLES_ID')));
     $view->render();
 }
Ejemplo n.º 4
0
 /**
  * Installer Step 4
  */
 protected function runStep4()
 {
     $sqlFiles = array();
     $files = \fpcm\classes\database::getTableFiles();
     foreach ($files as $value) {
         $sqlFiles[substr(basename($value, '.yml'), 2)] = base64_encode(str_rot13(base64_encode($value)));
     }
     $this->view->addJsVars(array('fpcmSqlFilesCount' => count($sqlFiles), 'fpcmSqlFiles' => $sqlFiles, 'fpcmSqlFileExec' => $this->lang->translate('INSTALLER_CREATETABLES_STEP')));
 }
Ejemplo n.º 5
0
 /**
  * Änderungen an Tabellen-Struktur vornehmen
  * @return bool
  */
 private function alterTables()
 {
     $res = true;
     if ($this->checkVersion('3.0.4')) {
         $res = $res && $this->dbcon->insert(\fpcm\classes\database::tableCronjobs, "`id`, `cjname`, `lastexec`", "7, 'dbBackup', 0");
     }
     if ($this->checkVersion('3.1.4')) {
         $res = $res && $this->dbcon->insert(\fpcm\classes\database::tableCronjobs, "`id`, `cjname`, `lastexec`", "8, 'fileindex', 0");
     }
     if ($this->checkVersion('3.1.0-rc1')) {
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD', '`imagepath`', 'TEXT NOT NULL');
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `title` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `categories` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `createuser` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `createtime` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `pinned` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `postponed` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `deleted` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `approval` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableArticles, 'ADD INDEX', '( `draft` )', '', false);
     }
     if ($this->checkVersion('3.2.0-dev')) {
         if (method_exists($this->dbcon, 'getDbtype') && $this->dbcon->getDbtype() == 'pgsql') {
             $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableCronjobs, 'ADD', '"execinterval"', '  BIGINT', false);
         } else {
             $res = $res && $this->dbcon->alter(\fpcm\classes\database::tablePermissions, 'CHANGE', '`permissionData`', '`permissiondata` BLOB NOT NULL', false);
             $res = $res && $this->dbcon->alter(\fpcm\classes\database::tablePermissions, 'CHANGE', '`rollId`', '`rollid` bigint(20) NOT NULL', false);
             $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableCategories, 'CHANGE', '`iconPath`', '`iconpath` text NOT NULL', false);
             $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableSessions, 'CHANGE', '`userId`', '`userid` BIGINT( 20 ) NOT NULL ', false);
             $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableSessions, 'CHANGE', '`sessionId`', '`sessionid` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ', false);
             $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableCronjobs, 'ADD', '`execinterval`', '  BIGINT( 20 ) NOT NULL', false);
         }
         $rows = array('anonymizeIps' => 2419200, 'clearLogs' => 2419200, 'clearTemp' => 604800, 'fmThumbs' => 604800, 'postponedArticles' => 600, 'updateCheck' => 86400, 'dbBackup' => 604800, 'fileindex' => 86400);
         foreach ($rows as $key => $value) {
             $res = $res && $this->dbcon->update(\fpcm\classes\database::tableCronjobs, array('execinterval'), array($value, $key), "cjname = ? AND execinterval = 0");
         }
     }
     if ($this->checkVersion('3.3.0-a1') && (!method_exists($this->dbcon, 'getDbtype') || $this->dbcon->getDbtype() == 'mysql')) {
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableComments, 'ADD INDEX', '( `name` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableComments, 'ADD INDEX', '( `email` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableComments, 'ADD INDEX', '( `website` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableComments, 'ADD INDEX', '( `private` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableComments, 'ADD INDEX', '( `approved` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableComments, 'ADD INDEX', '( `spammer` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableComments, 'ADD INDEX', '( `createtime` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableCronjobs, 'ADD UNIQUE', '( `cjname` )', '', false);
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableCronjobs, 'ADD INDEX', '( `lastexec` )', '', false);
     }
     if ($this->checkVersion('3.3.0-rc6') && (!method_exists($this->dbcon, 'getDbtype') || $this->dbcon->getDbtype() == 'mysql')) {
         $res = $res && $this->dbcon->alter(\fpcm\classes\database::tableConfig, 'ADD UNIQUE', '( `config_name` )', '', false);
     }
     if (method_exists($this->dbcon, 'getDbtype') && $this->checkVersion('3.3.0-rc6') && $this->dbcon->getDbtype() == 'pgsql') {
         $data = 'CREATE INDEX ' . $this->dbcon->getDbprefix() . '_comments_name ON ' . $this->dbcon->getDbprefix() . '_comments USING btree (name);' . 'CREATE INDEX ' . $this->dbcon->getDbprefix() . '_comments_email ON ' . $this->dbcon->getDbprefix() . '_comments USING btree (email);' . 'CREATE INDEX ' . $this->dbcon->getDbprefix() . '_comments_website ON ' . $this->dbcon->getDbprefix() . '_comments USING btree (website);' . 'CREATE INDEX ' . $this->dbcon->getDbprefix() . '_comments_private ON ' . $this->dbcon->getDbprefix() . '_comments USING btree (private);' . 'CREATE INDEX ' . $this->dbcon->getDbprefix() . '_comments_approved ON ' . $this->dbcon->getDbprefix() . '_comments USING btree (approved);' . 'CREATE INDEX ' . $this->dbcon->getDbprefix() . '_comments_spammer ON ' . $this->dbcon->getDbprefix() . '_comments USING btree (spammer);' . 'CREATE INDEX ' . $this->dbcon->getDbprefix() . '_comments_createtime ON ' . $this->dbcon->getDbprefix() . '_comments USING btree (createtime);' . 'CREATE UNIQUE INDEX ' . $this->dbcon->getDbprefix() . '_cronjobs_cjname ON ' . $this->dbcon->getDbprefix() . '_cronjobs USING btree (cjname);' . 'CREATE INDEX ' . $this->dbcon->getDbprefix() . '_cronjobs_lastexec ON ' . $this->dbcon->getDbprefix() . '_cronjobs USING btree (lastexec);' . 'CREATE UNIQUE INDEX ' . $this->dbcon->getDbprefix() . '_config_config_name ON ' . $this->dbcon->getDbprefix() . '_config USING btree (config_name);';
         $path = \fpcm\classes\baseconfig::$tempDir . 'indices.sql';
         file_put_contents($path, $data);
         $res = $res && $this->dbcon->execSqlFile($path);
         unlink($path);
     }
     if (!method_exists($this->dbcon, 'checkTableStructure')) {
         return $res;
     }
     $files = \fpcm\classes\database::getTableFiles();
     foreach ($files as $file) {
         $this->dbcon->checkTableStructure(basename($file, '.yml'));
     }
     if ($this->checkVersion('3.4.0-b2')) {
         $res = $res && $this->dbcon->insert(\fpcm\classes\database::tableCronjobs, "cjname, lastexec, execinterval", "'removeRevisions', 0, 2419200");
     }
     if ($this->checkVersion('3.4.0-b5')) {
         $this->dbcon->createIndex(\fpcm\classes\database::tableRevisions, 'hashsum_idx', 'hashsum');
     }
     if ($this->checkVersion('3.4.0-rc1')) {
         $this->dbcon->alter(\fpcm\classes\database::tableFiles, 'DROP', 'subfolder', '', false);
     }
     return $res;
 }
Ejemplo n.º 6
0
 /**
  * Löscht ein Objekt in der Datenbank
  * @return bool
  */
 public function delete()
 {
     $this->dbcon->delete($this->table, 'id = ?', array($this->id));
     $this->cache->cleanup();
     return true;
 }
Ejemplo n.º 7
0
 /**
  * Aktualisiert einen Artikel in der Datenbank
  * @return boolean
  */
 public function update()
 {
     return $this->dbcon->update($this->table, array('execinterval'), array($this->execinterval, $this->cronName), 'cjname ' . $this->dbcon->dbLike() . ' ?');
 }