diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d7ae8ec..8cf312d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: name: Extension tests (phpBB 3.3.x) uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@3.3.x with: - EXTNAME: tas2580/wiki + EXTNAME: phpbbmodders/wiki PHPBB_BRANCH: '3.3.x' RUN_FUNCTIONAL_TESTS: 0 @@ -26,7 +26,7 @@ jobs: name: Extension tests (phpBB master / 4.0) uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@master with: - EXTNAME: tas2580/wiki + EXTNAME: phpbbmodders/wiki PHPBB_BRANCH: 'master' RUN_FUNCTIONAL_TESTS: 0 PRIMARY_PHP_VERSION: '8.2' diff --git a/README.md b/README.md index df1242f..22f618e 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,28 @@ an active article offline or deleting it entirely: INSTALLATION ---------- To install this extension, download it and upload the files to your forum -under /ext/tas2580/wiki. Then go to the Admin panel of your forum and +under /ext/phpbbmodders/wiki. Then go to the Admin panel of your forum and navigate to Customise -> Extension Management -> Extensions. Find this extension in the list and click Enable. +UPGRADING FROM tas2580/wiki +---------- +This extension used to be installed as `tas2580/wiki`. It is now +`phpbbmodders/wiki`. To switch an existing board without losing any +articles, versions, permissions or notification settings: + +1. Disable the old **tas2580 Wiki** extension in the ACP. Do **not** delete its data. +2. Delete the `/ext/tas2580/wiki` folder. +3. Upload this version to `/ext/phpbbmodders/wiki` and enable it. The old + install's migration history, notification type and users' notification + settings are moved to the new name automatically; the wiki tables + themselves never included the old name, so they are used as they are. +4. Purge the board cache. + +If you disable the old extension from the command line (`bin/phpbbcli.php`) +instead of the ACP, run `bin/phpbbcli.php cache:purge` before enabling the +new one; the command-line disable doesn't clear the cache. + COMPATIBILITY ------- Verified working, end to end (create/edit/versioning/compare/approve-reject/ diff --git a/composer.json b/composer.json index 87946b1..b21c858 100644 --- a/composer.json +++ b/composer.json @@ -1,31 +1,45 @@ { - "name": "tas2580/wiki", + "name": "phpbbmodders/wiki", "type": "phpbb-extension", "description": "A simple wiki", - "homepage": "https://tas2580.net/downloads/phpbb-wiki/", + "homepage": "https://www.phpbbmodders.com/", "version": "1.1.0", - "keywords": ["phpbb", "extension", "wiki"], + "keywords": [ + "phpbb", + "extension", + "wiki", + "articles" + ], "license": "GPL-2.0-only", - "authors": [{ + "authors": [ + { + "name": "phpBB Modders", + "email": "board@phpbbmodders.com", + "homepage": "https://www.phpbbmodders.com/", + "role": "Extension Developer" + }, + { "name": "tas2580", "email": "mail@tas2580.net", "homepage": "https://tas2580.net", - "role": "Original author" - }, { + "role": "Past Developer" + }, + { "name": "Christian Schnegelberger (Crizz0)", "homepage": "https://www.crizzo.de", - "role": "phpBB.de 3.2.x fork maintainer" - }], + "role": "Past Developer" + } + ], "require": { - "php": ">=5.4.7" + "php": ">=7.1.3" }, "require-dev": { "phpbb/epv": "dev-master" }, "extra": { - "display-name": "tas2580 Wiki", + "display-name": "phpBB Modders Wiki", "soft-require": { "phpbb/phpbb": ">=3.3.0,<4.1@dev" } } -} \ No newline at end of file +} diff --git a/config/routing.yml b/config/routing.yml index 069984a..a9c5da9 100644 --- a/config/routing.yml +++ b/config/routing.yml @@ -1,9 +1,9 @@ -tas2580_wiki_index: +phpbbmodders_wiki_index: path: /wiki/ - defaults: { _controller: tas2580.wiki.overview:base } + defaults: { _controller: phpbbmodders.wiki.overview:base } -tas2580_wiki_article: +phpbbmodders_wiki_article: path: /wiki/{article} - defaults: { _controller: tas2580.wiki.main:article, article: "" } + defaults: { _controller: phpbbmodders.wiki.main:article, article: "" } diff --git a/config/services.yml b/config/services.yml index 8c602b5..885244c 100644 --- a/config/services.yml +++ b/config/services.yml @@ -5,8 +5,8 @@ services: _defaults: public: true - tas2580.wiki.overview: - class: tas2580\wiki\controller\overview + phpbbmodders.wiki.overview: + class: phpbbmodders\wiki\controller\overview arguments: - '@auth' - '@controller.helper' @@ -14,29 +14,29 @@ services: - '@request' - '@template' - '@user' - - '@tas2580.wiki.edit' - - '@tas2580.wiki.compare' - - '@tas2580.wiki.view' + - '@phpbbmodders.wiki.edit' + - '@phpbbmodders.wiki.compare' + - '@phpbbmodders.wiki.view' - '%core.root_path%' - '%core.php_ext%' - '%tables.wiki.article%' - tas2580.wiki.main: - class: tas2580\wiki\controller\main + phpbbmodders.wiki.main: + class: phpbbmodders\wiki\controller\main arguments: - '@auth' - '@controller.helper' - '@request' - '@template' - '@user' - - '@tas2580.wiki.delete' - - '@tas2580.wiki.edit' - - '@tas2580.wiki.compare' - - '@tas2580.wiki.view' + - '@phpbbmodders.wiki.delete' + - '@phpbbmodders.wiki.edit' + - '@phpbbmodders.wiki.compare' + - '@phpbbmodders.wiki.view' - '%core.root_path%' - '%core.php_ext%' - tas2580.wiki.listener: - class: tas2580\wiki\event\listener + phpbbmodders.wiki.listener: + class: phpbbmodders\wiki\event\listener arguments: - '@auth' - '@controller.helper' @@ -45,8 +45,8 @@ services: - '@user' tags: - { name: event.listener } - tas2580.wiki.edit: - class: tas2580\wiki\wiki\edit + phpbbmodders.wiki.edit: + class: phpbbmodders\wiki\wiki\edit arguments: - '@auth' - '@config' @@ -59,8 +59,8 @@ services: - '%tables.wiki.article%' - '%core.root_path%' - '%core.php_ext%' - tas2580.wiki.compare: - class: tas2580\wiki\wiki\compare + phpbbmodders.wiki.compare: + class: phpbbmodders\wiki\wiki\compare arguments: - '@auth' - '@config' @@ -73,30 +73,30 @@ services: - '%tables.wiki.article%' - '%core.root_path%' - '%core.php_ext%' - tas2580.wiki.delete: - class: tas2580\wiki\wiki\delete + phpbbmodders.wiki.delete: + class: phpbbmodders\wiki\wiki\delete arguments: - '@auth' - '@dbal.conn' - '@controller.helper' - '@user' - '%tables.wiki.article%' - tas2580.wiki.view: - class: tas2580\wiki\wiki\view + phpbbmodders.wiki.view: + class: phpbbmodders\wiki\wiki\view arguments: - '@auth' - '@dbal.conn' - '@controller.helper' - '@template' - '@user' - - '@tas2580.wiki.compare' - - '@tas2580.wiki.edit' + - '@phpbbmodders.wiki.compare' + - '@phpbbmodders.wiki.edit' - '%tables.wiki.article%' - '%core.root_path%' - '%core.php_ext%' - tas2580.wiki.notification.type.article_edit: - class: tas2580\wiki\notification\article_edit + phpbbmodders.wiki.notification.type.article_edit: + class: phpbbmodders\wiki\notification\article_edit shared: false arguments: - '@user_loader' @@ -110,12 +110,12 @@ services: - '%tables.user_notifications%' tags: - { name: notification.type } - tas2580.wiki.text_reparser.article_text: - class: tas2580\wiki\textreparser\plugins\article_text + phpbbmodders.wiki.text_reparser.article_text: + class: phpbbmodders\wiki\textreparser\plugins\article_text arguments: - '@dbal.conn' - '%tables.wiki.article%' calls: - - [set_name, [tas2580_wiki_article]] + - [set_name, [phpbbmodders_wiki_article]] tags: - { name: text_reparser.plugin} \ No newline at end of file diff --git a/controller/main.php b/controller/main.php index 47657a5..336a874 100644 --- a/controller/main.php +++ b/controller/main.php @@ -1,12 +1,14 @@ auth = $auth; $this->helper = $helper; @@ -92,7 +94,7 @@ public function index() */ public function article($article) { - $this->user->add_lang_ext('tas2580/wiki', 'common'); + $this->user->add_lang_ext('phpbbmodders/wiki', 'common'); if (!$this->auth->acl_get('u_wiki_view')) { @@ -101,7 +103,7 @@ public function article($article) $this->template->assign_block_vars('navlinks', array( 'FORUM_NAME' => $this->user->lang('WIKI'), - 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_index', array()), + 'U_VIEW_FORUM' => $this->helper->route('phpbbmodders_wiki_index', array()), )); $this->template->assign_vars(array( diff --git a/controller/overview.php b/controller/overview.php index a786469..f4b6c77 100644 --- a/controller/overview.php +++ b/controller/overview.php @@ -1,12 +1,14 @@ auth = $auth; $this->helper = $helper; @@ -81,8 +83,8 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\controller\helper $he public function base() { - $this->user->add_lang_ext('tas2580/wiki', 'common'); - $this->user->add_lang_ext('tas2580/wiki', 'overview'); + $this->user->add_lang_ext('phpbbmodders/wiki', 'common'); + $this->user->add_lang_ext('phpbbmodders/wiki', 'overview'); // get all article @@ -95,7 +97,7 @@ public function base() while ($all_wiki_article = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('all_wiki_article', array( - 'U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $all_wiki_article['article_url'])), + 'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $all_wiki_article['article_url'])), 'ARTICLE_NAME' => $all_wiki_article['article_title'], 'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'], 'ARTICLE_VIEWS' => $all_wiki_article['article_views'], @@ -116,7 +118,7 @@ public function base() while ($all_wiki_article = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('latest_wiki_article', array( - 'U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $all_wiki_article['article_url'])), + 'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $all_wiki_article['article_url'])), 'ARTICLE_NAME' => $all_wiki_article['article_title'], 'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'], 'ARTICLE_VIEWS' => $all_wiki_article['article_views'], @@ -137,7 +139,7 @@ public function base() while ($all_wiki_article = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('hot_wiki_article', array( - 'U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $all_wiki_article['article_url'])), + 'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $all_wiki_article['article_url'])), 'ARTICLE_NAME' => $all_wiki_article['article_title'], 'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'], 'ARTICLE_VIEWS' => $all_wiki_article['article_views'], @@ -159,7 +161,7 @@ public function base() while ($all_wiki_article = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('sticky_wiki_article', array( - 'U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $all_wiki_article['article_url'])), + 'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $all_wiki_article['article_url'])), 'ARTICLE_NAME' => $all_wiki_article['article_title'], 'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'], 'ARTICLE_VIEWS' => $all_wiki_article['article_views'], @@ -206,15 +208,15 @@ public function base() $is_stale = ($active_last_edit !== false && $active_last_edit >= $pending_wiki_article['article_last_edit']); $this->template->assign_block_vars('pending_wiki_article', array( - 'U_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $pending_wiki_article['article_url'])), + 'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $pending_wiki_article['article_url'])), 'ARTICLE_NAME' => $pending_wiki_article['article_title'], 'ARTICLE_LASTEDIT' => $this->user->format_date($pending_wiki_article['article_last_edit']), 'S_STALE' => $is_stale, 'S_SET_ACTIVE' => $s_set_active && !$is_stale, 'S_DELETE' => $s_delete, - 'U_SET_ACTIVE' => $this->helper->route('tas2580_wiki_article', array('action' => 'active', 'id' => $pending_wiki_article['article_id'])), - 'U_DELETE' => $this->helper->route('tas2580_wiki_article', array('action' => 'delete', 'id' => $pending_wiki_article['article_id'])), - 'U_VERSIONS' => $this->helper->route('tas2580_wiki_article', array('article' => $pending_wiki_article['article_url'], 'action' => 'versions')), + 'U_SET_ACTIVE' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'active', 'id' => $pending_wiki_article['article_id'])), + 'U_DELETE' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'delete', 'id' => $pending_wiki_article['article_id'])), + 'U_VERSIONS' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $pending_wiki_article['article_url'], 'action' => 'versions')), ) ); } diff --git a/event/listener.php b/event/listener.php index 3f1c7db..6e1c7e6 100644 --- a/event/listener.php +++ b/event/listener.php @@ -1,12 +1,14 @@ 'tas2580.wiki.notification.type.article_edit', + 'item_type' => 'phpbbmodders.wiki.notification.type.article_edit', 'method' => 'notification.method.email', ), ); @@ -153,9 +155,9 @@ public function page_header($event) { if ($this->auth->acl_get('u_wiki_view')) { - $this->user->add_lang_ext('tas2580/wiki', 'common'); + $this->user->add_lang_ext('phpbbmodders/wiki', 'common'); $this->template->assign_vars(array( - 'U_WIKI' => $this->helper->route('tas2580_wiki_index', array()), + 'U_WIKI' => $this->helper->route('phpbbmodders_wiki_index', array()), )); } } @@ -171,7 +173,7 @@ public function user_setup($event) { $lang_ary = $event['lang_set_ext']; $lang_ary[] = array( - 'ext_name' => 'tas2580/wiki', + 'ext_name' => 'phpbbmodders/wiki', 'lang_set' => 'link', ); $event['lang_set_ext'] = $lang_ary; diff --git a/ext.php b/ext.php index 3cbbfd9..8e460b0 100644 --- a/ext.php +++ b/ext.php @@ -1,72 +1,298 @@ container->get('ext.manager')->is_enabled(self::OLD_EXT_NAME)) + { + return ['Disable the old "' . self::OLD_EXT_NAME . '" extension first (keep its data, do not delete it).']; + } + + return true; + } + + /** + * Move an old install's data to the new name, then enable as usual. + * + * @param mixed $old_state State returned by previous call of this method + * @return bool|string + */ public function enable_step($old_state) { + if ($old_state === false) + { + $this->move_old_install(); + + // The migrator loaded its state before this ran; reload it so the + // moved migration history counts as already installed. + $this->migrator->load_migration_state(); + } + switch ($old_state) { - case '': // Empty means nothing has run yet - return $this->notification_handler('enable', array( - 'tas2580.wiki.notification.type.article_edit', - )); - break; + case false: + case '': + return $this->notification_handler('enable', [self::NEW_NOTIFICATION_TYPE]); + default: - // Run parent enable step method return parent::enable_step($old_state); - break; } } + + /** + * Disable the notification type, then disable as usual. + * + * @param mixed $old_state State returned by previous call of this method + * @return bool|string + */ public function disable_step($old_state) { switch ($old_state) { - case '': // Empty means nothing has run yet - return $this->notification_handler('disable', array( - 'tas2580.wiki.notification.type.article_edit', - )); - break; + case false: + case '': + return $this->notification_handler('disable', [self::NEW_NOTIFICATION_TYPE]); + default: - // Run parent disable step method return parent::disable_step($old_state); - break; } } + + /** + * Purge the notification type, then revert migrations as usual. + * + * @param mixed $old_state State returned by previous call of this method + * @return bool|string + */ public function purge_step($old_state) { switch ($old_state) { - case '': // Empty means nothing has run yet - return $this->notification_handler('purge', array( - 'tas2580.wiki.notification.type.article_edit', - )); - break; + case false: + case '': + return $this->notification_handler('purge', [self::NEW_NOTIFICATION_TYPE]); + default: - // Run parent purge step method return parent::purge_step($old_state); - break; } } + + /** + * Run a notification manager step for each notification type. + * + * @param string $step enable, disable or purge + * @param array $notification_types Notification type service names + * @return string + */ protected function notification_handler($step, $notification_types) { $phpbb_notifications = $this->container->get('notification_manager'); + foreach ($notification_types as $notification_type) { $phpbb_notifications->{$step . '_notifications'}($notification_type); } + return 'notifications'; } + + /** + * Rewrite everything the database stores under the old name. + * + * Rows are filtered in PHP rather than with LIKE, because namespace + * backslashes and underscores are special characters in LIKE patterns + * on some databases. The tables involved are small. + */ + protected function move_old_install() + { + $db = $this->container->get('dbal.conn'); + $prefix = $this->container->getParameter('core.table_prefix'); + + $db->sql_transaction('begin'); + + // Migration history, including each migration's dependency list + $result = $db->sql_query('SELECT migration_name, migration_depends_on FROM ' . $prefix . 'migrations'); + $rows = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + foreach ($rows as $row) + { + if ($this->new_class_name($row['migration_name']) === $row['migration_name']) + { + continue; + } + + $depends_on = unserialize($row['migration_depends_on'], ['allowed_classes' => false]); + $depends_on = is_array($depends_on) ? array_map([$this, 'new_class_name'], $depends_on) : []; + + $db->sql_query('UPDATE ' . $prefix . 'migrations SET ' . $db->sql_build_array('UPDATE', [ + 'migration_name' => $this->new_class_name($row['migration_name']), + 'migration_depends_on' => serialize($depends_on), + ]) . " WHERE migration_name = '" . $db->sql_escape($row['migration_name']) . "'"); + } + + // Module classes and their "ext_vendor/name" auth checks + $result = $db->sql_query('SELECT module_id, module_basename, module_auth FROM ' . $prefix . 'modules'); + $rows = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + foreach ($rows as $row) + { + $basename = $this->new_class_name($row['module_basename']); + $auth = str_replace('ext_' . self::OLD_EXT_NAME, 'ext_' . self::NEW_EXT_NAME, $row['module_auth']); + + if ($basename !== $row['module_basename'] || $auth !== $row['module_auth']) + { + $db->sql_query('UPDATE ' . $prefix . 'modules SET ' . $db->sql_build_array('UPDATE', [ + 'module_basename' => $basename, + 'module_auth' => $auth, + ]) . ' WHERE module_id = ' . (int) $row['module_id']); + } + } + + // Notification type, and every user's subscription to it. Rows are + // moved one at a time: both spellings of the old name can exist, and + // both tables have unique indexes on the name. + $types_table = $prefix . 'notification_types'; + $subs_table = $prefix . 'user_notifications'; + + foreach (self::OLD_NOTIFICATION_TYPES as $old_type) + { + $result = $db->sql_query('SELECT notification_type_id FROM ' . $types_table . " + WHERE notification_type_name = '" . $db->sql_escape(self::NEW_NOTIFICATION_TYPE) . "'"); + $new_type_exists = $db->sql_fetchfield('notification_type_id') !== false; + $db->sql_freeresult($result); + + if (!$new_type_exists) + { + $db->sql_query('UPDATE ' . $types_table . " + SET notification_type_name = '" . $db->sql_escape(self::NEW_NOTIFICATION_TYPE) . "' + WHERE notification_type_name = '" . $db->sql_escape($old_type) . "'"); + } + + $result = $db->sql_query('SELECT item_id, user_id, method FROM ' . $subs_table . " + WHERE item_type = '" . $db->sql_escape($old_type) . "'"); + $subscriptions = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + foreach ($subscriptions as $row) + { + // phpBB 3.3 has no id column here; the unique key identifies a row + $key = ' AND item_id = ' . (int) $row['item_id'] . ' + AND user_id = ' . (int) $row['user_id'] . " + AND method = '" . $db->sql_escape($row['method']) . "'"; + + $result = $db->sql_query('SELECT user_id FROM ' . $subs_table . " + WHERE item_type = '" . $db->sql_escape(self::NEW_NOTIFICATION_TYPE) . "'" . $key); + $duplicate = $db->sql_fetchfield('user_id') !== false; + $db->sql_freeresult($result); + + $db->sql_query($duplicate + ? 'DELETE FROM ' . $subs_table . " + WHERE item_type = '" . $db->sql_escape($old_type) . "'" . $key + : 'UPDATE ' . $subs_table . " + SET item_type = '" . $db->sql_escape(self::NEW_NOTIFICATION_TYPE) . "' + WHERE item_type = '" . $db->sql_escape($old_type) . "'" . $key); + } + } + + // Resume point of an interrupted "reparser:reparse" CLI run + $config_text = $this->container->get('config_text'); + $resume = $config_text->get('reparser_resume'); + $resume = !empty($resume) ? unserialize($resume, ['allowed_classes' => false]) : []; + if (is_array($resume) && isset($resume[self::OLD_REPARSER_NAME])) + { + $resume[self::NEW_REPARSER_NAME] = $resume[self::OLD_REPARSER_NAME]; + unset($resume[self::OLD_REPARSER_NAME]); + $config_text->set('reparser_resume', serialize($resume)); + } + + // The old extension's own record (only once it's disabled) + $db->sql_query('DELETE FROM ' . $prefix . "ext + WHERE ext_name = '" . $db->sql_escape(self::OLD_EXT_NAME) . "' + AND ext_active = 0"); + + $db->sql_transaction('commit'); + } + + /** + * Map an old fully qualified class name to the new namespace. + * + * @param string $class_name Class name, possibly under the old namespace + * @return string + */ + protected function new_class_name($class_name) + { + if (!is_string($class_name)) + { + return $class_name; + } + + // Class names may be stored with or without the leading backslash + foreach ([self::OLD_NAMESPACE, ltrim(self::OLD_NAMESPACE, '\\')] as $old) + { + if (strpos($class_name, $old) === 0) + { + $new = ($old === self::OLD_NAMESPACE) ? self::NEW_NAMESPACE : ltrim(self::NEW_NAMESPACE, '\\'); + return $new . substr($class_name, strlen($old)); + } + } + + return $class_name; + } } diff --git a/language/de/common.php b/language/de/common.php index e007d7f..7f24c10 100644 --- a/language/de/common.php +++ b/language/de/common.php @@ -1,11 +1,13 @@ db, $this->container->getParameter('core.table_prefix') . 'wiki_article' ); diff --git a/migrations/update_0_1_2.php b/migrations/update_0_1_2.php index 0fb3628..a20cddf 100644 --- a/migrations/update_0_1_2.php +++ b/migrations/update_0_1_2.php @@ -1,20 +1,22 @@ htmlspecialchars_decode($this->get_title()), 'USERNAME' => htmlspecialchars_decode($this->user->data['username']), - 'U_LINK' => generate_board_url() . $this->helper->route('tas2580_wiki_article', array('article' => $this->get_data('article_url'))), + 'U_LINK' => generate_board_url() . $this->helper->route('phpbbmodders_wiki_article', array('article' => $this->get_data('article_url'))), ); } /** @@ -124,7 +126,7 @@ public function get_avatar() */ public function get_url() { - return $this->helper->route('tas2580_wiki_article', array('article' => $this->get_data('article_url'))); + return $this->helper->route('phpbbmodders_wiki_article', array('article' => $this->get_data('article_url'))); } /** @@ -139,12 +141,12 @@ public function get_title() public function get_type() { - return 'tas2580.wiki.notification.type.article_edit'; + return 'phpbbmodders.wiki.notification.type.article_edit'; } public function get_email_template() { - return '@tas2580_wiki/mail_article_edit'; + return '@phpbbmodders_wiki/mail_article_edit'; } public function create_insert_array($notification_data, $pre_create_data = array()) diff --git a/styles/prosilver/template/article_versions.html b/styles/prosilver/template/article_versions.html index 396ad6f..a1784ee 100644 --- a/styles/prosilver/template/article_versions.html +++ b/styles/prosilver/template/article_versions.html @@ -79,6 +79,6 @@

{L_VERSIONS_OF_ARTICLE}{L_COLON} {ARTICLE_TITLE}

- + \ No newline at end of file diff --git a/styles/prosilver/template/event/overall_header_head_append.html b/styles/prosilver/template/event/overall_header_head_append.html index d480fb4..177fd7d 100644 --- a/styles/prosilver/template/event/overall_header_head_append.html +++ b/styles/prosilver/template/event/overall_header_head_append.html @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/tests/migrations/database/add_article_description_test.php b/tests/migrations/database/add_article_description_test.php index 05b7b2d..007f102 100644 --- a/tests/migrations/database/add_article_description_test.php +++ b/tests/migrations/database/add_article_description_test.php @@ -1,13 +1,14 @@ helper->route('tas2580_wiki_index', array('id' => $from)); - $u_to = $this->helper->route('tas2580_wiki_index', array('id' => $to)); + $u_from = $this->helper->route('phpbbmodders_wiki_index', array('id' => $from)); + $u_to = $this->helper->route('phpbbmodders_wiki_index', array('id' => $to)); $article_diff = new \diff($from_article['text'], $to_article['text']); $article_diff_empty = $article_diff->is_empty(); @@ -126,17 +128,17 @@ public function compare_versions($article, $from, $to) 'REJECT_VERSION_FROM' => sprintf($this->user->lang('REJECT_VERSION'), $from), 'S_SET_ACTIVE_FROM' => $s_set_active && !$from_row['article_approved'], 'S_DELETE_FROM' => $s_delete && !$from_row['article_approved'], - 'U_SET_ACTIVE_FROM' => $this->helper->route('tas2580_wiki_article', array('action' => 'active', 'id' => $from)), - 'U_DELETE_FROM' => $this->helper->route('tas2580_wiki_article', array('action' => 'delete', 'id' => $from)), + 'U_SET_ACTIVE_FROM' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'active', 'id' => $from)), + 'U_DELETE_FROM' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'delete', 'id' => $from)), 'APPROVE_VERSION_TO' => sprintf($this->user->lang('APPROVE_VERSION'), $to), 'REJECT_VERSION_TO' => sprintf($this->user->lang('REJECT_VERSION'), $to), 'S_SET_ACTIVE_TO' => $s_set_active && !$to_row['article_approved'], 'S_DELETE_TO' => $s_delete && !$to_row['article_approved'], - 'U_SET_ACTIVE_TO' => $this->helper->route('tas2580_wiki_article', array('action' => 'active', 'id' => $to)), - 'U_DELETE_TO' => $this->helper->route('tas2580_wiki_article', array('action' => 'delete', 'id' => $to)), + 'U_SET_ACTIVE_TO' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'active', 'id' => $to)), + 'U_DELETE_TO' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'delete', 'id' => $to)), - 'U_BACK' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'versions')), + 'U_BACK' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'action' => 'versions')), )); return $this->helper->render('article_compare.html', $this->user->lang('VERSIONS_OF_ARTICLE')); @@ -162,16 +164,16 @@ public function view_versions($article) 'S_SET_ACTIVE' => $this->auth->acl_get('u_wiki_set_active'), 'S_DELETE' => $this->auth->acl_get('m_wiki_delete'), 'S_DELETE_ARTICLE' => $this->auth->acl_get('m_wiki_delete_article'), - 'U_ACTION' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'compare')), - 'U_DELETE_ARTICLE' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'detele_article')), - 'U_SET_INACTIV' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'deactivate')), + 'U_ACTION' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'action' => 'compare')), + 'U_DELETE_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'action' => 'detele_article')), + 'U_SET_INACTIV' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'action' => 'deactivate')), )); if (!empty($article)) { $this->template->assign_block_vars('navlinks', array( 'FORUM_NAME' => $this->data['article_title'], - 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_article', array('article' => $article)), + 'U_VIEW_FORUM' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article)), )); } @@ -214,9 +216,9 @@ public function view_versions($article) 'S_ACTIVE' => ($this->data['article_approved'] == 1) ? true : false, 'USER' => get_username_string('full', $this->data['user_id'], $this->data['username'], $this->data['user_colour']), 'EDIT_TIME' => $this->user->format_date($this->data['article_last_edit']), - 'U_VERSION' => $this->helper->route('tas2580_wiki_article', array('id' => $this->data['article_id'])), - 'U_DELETE' => $this->helper->route('tas2580_wiki_article', array('action' => 'delete', 'id' => $this->data['article_id'])), - 'U_SET_ACTIVE' => $this->helper->route('tas2580_wiki_article', array('action' => 'active', 'id' => $this->data['article_id'])), + 'U_VERSION' => $this->helper->route('phpbbmodders_wiki_article', array('id' => $this->data['article_id'])), + 'U_DELETE' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'delete', 'id' => $this->data['article_id'])), + 'U_SET_ACTIVE' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'active', 'id' => $this->data['article_id'])), )); } $this->db->sql_freeresult($result); @@ -227,7 +229,7 @@ public function view_versions($article) trigger_error('NOT_AUTHORISED'); } - $pagination_url = $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'versions')); + $pagination_url = $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'action' => 'versions')); $start = $this->pagination->validate_start($start, $this->config['topics_per_page'], $total_count); $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_count, $this->config['topics_per_page'], $start); diff --git a/wiki/delete.php b/wiki/delete.php index e26127c..9ab5628 100644 --- a/wiki/delete.php +++ b/wiki/delete.php @@ -1,14 +1,16 @@ db->sql_freeresult($result); if ($row['article_approved'] <> 0) { - trigger_error($this->user->lang('NO_DELETE_ACTIVE_VERSION') . '

' . $this->user->lang('BACK_TO_ARTICLE') . ''); + trigger_error($this->user->lang('NO_DELETE_ACTIVE_VERSION') . '

' . $this->user->lang('BACK_TO_ARTICLE') . ''); } if (confirm_box(true)) @@ -78,7 +80,7 @@ public function version($id) WHERE article_id = ' . (int) $id; $this->db->sql_query($sql); //return $helper->message('DELETE_VERSION_SUCCESS', array()); - trigger_error($this->user->lang('DELETE_VERSION_SUCCESS') . '

' . $this->user->lang('BACK_TO_ARTICLE') . ''); + trigger_error($this->user->lang('DELETE_VERSION_SUCCESS') . '

' . $this->user->lang('BACK_TO_ARTICLE') . ''); } else { @@ -87,7 +89,7 @@ public function version($id) )); confirm_box(false, $this->user->lang('CONFIRM_DELETE_VERSION'), $s_hidden_fields); } - redirect($this->helper->route('tas2580_wiki_index', array('id' => $id))); + redirect($this->helper->route('phpbbmodders_wiki_index', array('id' => $id))); } /** @@ -108,7 +110,7 @@ public function article($article) $sql = 'DELETE FROM ' . $this->article_table . " WHERE article_url = '" . $this->db->sql_escape($article) . "'"; $this->db->sql_query($sql); - trigger_error($this->user->lang('DELETE_ARTICLE_SUCCESS') . '

' . $this->user->lang('BACK_TO_WIKI') . ''); + trigger_error($this->user->lang('DELETE_ARTICLE_SUCCESS') . '

' . $this->user->lang('BACK_TO_WIKI') . ''); } else { @@ -117,6 +119,6 @@ public function article($article) )); confirm_box(false, $this->user->lang('CONFIRM_DELETE_ARTICLE'), $s_hidden_fields); } - redirect($this->helper->route('tas2580_wiki_index', array('article' => $article))); + redirect($this->helper->route('phpbbmodders_wiki_index', array('article' => $article))); } } diff --git a/wiki/edit.php b/wiki/edit.php index ef9b597..49227e7 100644 --- a/wiki/edit.php +++ b/wiki/edit.php @@ -1,14 +1,16 @@ set_active_version($id); - $back_url = empty($article) ? $this->helper->route('tas2580_wiki_index', array()) : $this->helper->route('tas2580_wiki_article', array('article' => $article)); + $back_url = empty($article) ? $this->helper->route('phpbbmodders_wiki_index', array()) : $this->helper->route('phpbbmodders_wiki_article', array('article' => $article)); trigger_error($this->user->lang('ACTIVATE_VERSION_SUCCESS') . '

' . $this->user->lang('BACK_TO_ARTICLE') . ''); } else @@ -112,7 +114,7 @@ public function active($id) )); confirm_box(false, $this->user->lang('CONFIRM_ACTIVATE_VERSION'), $s_hidden_fields); } - redirect($this->helper->route('tas2580_wiki_article', array('article' => $article))); + redirect($this->helper->route('phpbbmodders_wiki_article', array('article' => $article))); } /** @@ -136,7 +138,7 @@ public function deactivate($article) WHERE article_url = '" . $this->db->sql_escape($article) . "'"; $this->db->sql_query($sql); - trigger_error($this->user->lang('DEACTIVATE_ARTICLE_SUCCESS') . '

' . $this->user->lang('BACK_TO_WIKI') . ''); + trigger_error($this->user->lang('DEACTIVATE_ARTICLE_SUCCESS') . '

' . $this->user->lang('BACK_TO_WIKI') . ''); } else { @@ -145,7 +147,7 @@ public function deactivate($article) )); confirm_box(false, $this->user->lang('CONFIRM_DEACTIVATE_ARTICLE'), $s_hidden_fields); } - redirect($this->helper->route('tas2580_wiki_article', array('article' => $article))); + redirect($this->helper->route('phpbbmodders_wiki_article', array('article' => $article))); } @@ -294,10 +296,10 @@ public function edit_article($article) 'article_url' => $article, 'user_id' => $this->user->data['user_id'], ); - $this->notification_manager->add_notifications('tas2580.wiki.notification.type.article_edit', $notify_data); + $this->notification_manager->add_notifications('phpbbmodders.wiki.notification.type.article_edit', $notify_data); } $msg = ($this->data['article_approved'] <> 0) ? $this->user->lang('EDIT_ARTICLE_SUCCESS') : $this->user->lang('EDIT_ARTICLE_SUCCESS_INACTIVE'); - $back_url = empty($article) ? $this->helper->route('tas2580_wiki_index', array()) : $this->helper->route('tas2580_wiki_article', array('article' => $article)); + $back_url = empty($article) ? $this->helper->route('phpbbmodders_wiki_index', array()) : $this->helper->route('phpbbmodders_wiki_article', array('article' => $article)); trigger_error($msg . '

' . $this->user->lang('BACK_TO_ARTICLE') . ''); } // Get the last version of the article to edit diff --git a/wiki/functions.php b/wiki/functions.php index 01602a5..7b1e70a 100644 --- a/wiki/functions.php +++ b/wiki/functions.php @@ -1,12 +1,14 @@ auth = $auth; $this->db = $db; @@ -117,14 +119,14 @@ public function view_article($article, $id = 0) { $this->template->assign_vars(array( 'S_NEW_VERSION' => true, - 'U_NEW_VERSION' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'id' => $row['article_id'])), + 'U_NEW_VERSION' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'id' => $row['article_id'])), )); } } if (($id <> 0) && ($this->data['article_approved'] <> 1) && $this->auth->acl_get('u_wiki_set_active')) { $this->template->assign_vars(array( - 'U_SET_ACTIVE' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'active', 'id' => $id)), + 'U_SET_ACTIVE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'action' => 'active', 'id' => $id)), )); } @@ -132,7 +134,7 @@ public function view_article($article, $id = 0) { $this->template->assign_block_vars('navlinks', array( 'FORUM_NAME' => $this->data['article_title'], - 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_article', array('article' => $article)), + 'U_VIEW_FORUM' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article)), )); } @@ -176,7 +178,7 @@ public function view_article($article, $id = 0) if (!empty($this->data['article_redirect'])) { - $redirect_note = $this->user->lang('NO_ARTICLE_REDIRECT', $this->helper->route('tas2580_wiki_article', array('article' => $this->data['article_redirect'])), $this->data['article_redirect']); + $redirect_note = $this->user->lang('NO_ARTICLE_REDIRECT', $this->helper->route('phpbbmodders_wiki_article', array('article' => $this->data['article_redirect'])), $this->data['article_redirect']); if ($this->auth->acl_get('u_wiki_set_redirect')) { @@ -202,11 +204,11 @@ public function view_article($article, $id = 0) 'LAST_EDIT_ISO' => date('Y-m-d', $this->data['article_last_edit']), 'ARTICLE_USER' => get_username_string('full', $this->data['user_id'], $this->data['username'], $this->data['user_colour']), 'S_EDIT' => ($this->auth->acl_get('u_wiki_edit') && $s_edit_redirect), - 'U_EDIT' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'edit')), + 'U_EDIT' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'action' => 'edit')), 'S_VERSIONS' => $this->auth->acl_get('u_wiki_versions'), - 'U_VERSIONS' => $this->helper->route('tas2580_wiki_article', array('article' => $article, 'action' => 'versions')), + 'U_VERSIONS' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $article, 'action' => 'versions')), 'S_DELETE' => ($this->auth->acl_get('m_wiki_delete') && !$this->data['article_approved']), - 'U_DELETE' => $this->helper->route('tas2580_wiki_article', array('action' => 'delete', 'id' => $this->data['article_id'])), + 'U_DELETE' => $this->helper->route('phpbbmodders_wiki_article', array('action' => 'delete', 'id' => $this->data['article_id'])), 'ARTICLE_VERSION' => $id, 'ARTICLE_VIEWS_TEXT' => $this->user->lang('ARTICLE_VIEWS_TEXT', $this->data['article_views']), 'EDIT_REASON' => ($id <> 0) ? $this->data['article_edit_reason'] : '',