Skip to content

Commit fd29c3d

Browse files
committed
Update FeatherBB version in Db after upgrade
1 parent 682d72f commit fd29c3d

File tree

4 files changed

+2
-39
lines changed

4 files changed

+2
-39
lines changed

featherbb/Controller/Admin/Updates.php

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -79,38 +79,6 @@ public function display($req, $res, $args)
7979
)->addTemplate('admin/updates.php')->display();
8080
}
8181

82-
public function check($req, $res, $args)
83-
{
84-
Container::get('hooks')->fire('controller.admin.updates.check');
85-
86-
// Check for upgrade
87-
if ($args['action'] == 'check_upgrade') {
88-
if (!ini_get('allow_url_fopen')) {
89-
throw new Error(__('fopen disabled message'), 500);
90-
}
91-
92-
$latest_version = trim(@file_get_contents('http://featherbb.org/latest_version.html'));
93-
if (empty($latest_version)) {
94-
throw new Error(__('Upgrade check failed message'), 500);
95-
}
96-
97-
if (version_compare(ForumSettings::get('o_cur_version'), $latest_version, '>=')) {
98-
return Router::redirect(Router::pathFor('adminIndex'), __('Running latest version message'));
99-
} else {
100-
return Router::redirect(Router::pathFor('adminIndex'), sprintf(__('New version available message'), '<a href="http://featherbb.org/">FeatherBB.org</a>'));
101-
}
102-
}
103-
104-
AdminUtils::generateAdminMenu('updates');
105-
106-
return View::setPageInfo(array(
107-
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Updates')),
108-
'active_page' => 'admin',
109-
'admin_console' => true
110-
)
111-
)->addTemplate('admin/updates.php')->display();
112-
}
113-
11482
public function upgradePlugins($req, $res, $args)
11583
{
11684
Container::get('hooks')->fire('controller.admin.updates.upgradePlugins');
@@ -175,7 +143,7 @@ public function upgradeCore($req, $res, $args)
175143
$upgrade_results[$key]['errors'] = $coreUpdater->getErrors();
176144
} else {
177145
$upgrade_results[$key]['message'] = sprintf('Core %s successfull update %s', ForumEnv::get('FORUM_VERSION'), $coreUpdater->getLatestVersion());
178-
if (!Database::for_table('config')->set('o_cur_version', ForumEnv::get('FORUM_VERSION'))->save()) {
146+
if (!Database::for_table('config')->raw_execute('UPDATE `'.ForumSettings::get('db_prefix').'config` SET `conf_value` = :value WHERE `conf_name` = "o_cur_version"', array('value' => ForumEnv::get('FORUM_VERSION')))) {
179147
$coreUpdater->_warnings[] = __('Could not update core version in database');
180148
}
181149
}

featherbb/View/admin/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<dl>
4141
<dt><?php _e('FeatherBB version label') ?></dt>
4242
<dd>
43-
<?php printf(__('FeatherBB version data')."\n", ForumSettings::get('o_cur_version'), '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.Router%3A%3A%3Cspan+class%3D"pl-en">pathFor('adminAction', ['action' => 'check_upgrade']).'">'.__('Check for upgrade').'</a>') ?>
43+
<?php printf(__('FeatherBB version data')."\n", ForumSettings::get('o_cur_version'), '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%27%3C%2Fspan%3E.Router%3A%3A%3Cspan+class%3D"pl-en">pathFor('adminUpdates').'">'.__('Check for upgrade').'</a>') ?>
4444
</dd>
4545
<dt><?php _e('Server statistics label') ?></dt>
4646
<dd>

featherbb/View/admin/updates.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@
161161
</td>
162162
</tr>
163163
<?php endforeach; ?>
164-
<!-- <tr><th scope="row"><a href="http://localhost/admin/groups/edit/1" tabindex="5">Edit</a></th><td>Administrators</td></tr>
165-
<tr><th scope="row"><a href="http://localhost/admin/groups/edit/2" tabindex="6">Edit</a></th><td>Moderators</td></tr>
166-
<tr><th scope="row"><a href="http://localhost/admin/groups/edit/3" tabindex="7">Edit</a></th><td>Guests</td></tr>
167-
<tr><th scope="row"><a href="http://localhost/admin/groups/edit/4" tabindex="8">Edit</a></th><td>Members</td></tr> -->
168164
</table>
169165
</div>
170166
</fieldset>

featherbb/routes.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107

108108
// Admin updates
109109
Route::get('/updates', '\FeatherBB\Controller\Admin\Updates:display')->setName('adminUpdates');
110-
Route::get('/updates/check', '\FeatherBB\Controller\Admin\Updates:check')->setName('adminCheckUpdates');
111110
Route::post('/updates/upgrade-core', '\FeatherBB\Controller\Admin\Updates:upgradeCore')->setName('adminUpgradeCore');
112111
Route::post('/updates/upgrade-plugins', '\FeatherBB\Controller\Admin\Updates:upgradePlugins')->setName('adminUpgradePlugins');
113112
Route::post('/updates/upgrade-themes', '\FeatherBB\Controller\Admin\Updates:upgradeThemes')->setName('adminUpgradeThemes');

0 commit comments

Comments
 (0)