newVersion(Core::id(), dcCore::app()->plugins->moduleInfo(Core::id(), 'version')); return self::$init; } public static function process() { if (!self::$init) { return false; } try { // Upgrade self::growUp(); // Set module settings dcCore::app()->blog->settings->addNamespace(Core::id()); foreach (self::$mod_conf as $v) { dcCore::app()->blog->settings->__get(Core::id())->put( $v[0], $v[2], $v[3], $v[1], false, true ); } return true; } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); return false; } } public static function growUp() { $current = dcCore::app()->getVersion(Core::id()); // Update settings id, ns if ($current && version_compare($current, '2022.12.19.1', '<=')) { $record = dcCore::app()->con->select( 'SELECT * FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . ' ' . "WHERE setting_ns = 'pacKman' " ); while ($record->fetch()) { if (preg_match('/^packman_(.*?)$/', $record->setting_id, $match)) { $cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME); $cur->setting_id = $match[1]; $cur->setting_ns = Core::id(); $cur->update( "WHERE setting_id = '" . $record->setting_id . "' and setting_ns = 'pacKman' " . 'AND blog_id ' . (null === $record->blog_id ? 'IS NULL ' : ("= '" . dcCore::app()->con->escape($record->blog_id) . "' ")) ); } } } } }