Bug#541371: wordpress: Unable to upgrade wp db with non-default admin
Ivan Warren ha scritto:
> Right... But I tried with "current_user_can('level_10')" and that seems
> to work fine. Something like :
>
> **
> --- upgrade.php.orig2009-08-15 12:35:51.0 +0200
> +++ upgrade.php 2009-08-15 12:27:25.0 +0200
> @@ -21,6 +21,7 @@
> $current_user = wp_get_current_user();
> $user_id = $current_user->ID;
> if ($user_id != 1)
> + if(!current_user_can('level_10'))
> wp_safe_redirect('../wp-login.php?upgrade');
>
> timer_start();
> **
Sweet, I will use your patch in the next upload, thanks!
Cheers,
Giuseppe.
signature.asc
Description: OpenPGP digital signature
Bug#541371: wordpress: Unable to upgrade wp db with non-default admin
Giuseppe Iuculano wrote:
Hi Ivan,
Why an installation shouldn't have the default wordpress admin user?
Well, the 'default' administrator may no longer exist for several
reasons, but the main reason is because it was removed after
installation since it didn't seem necessary to keep it based on the fact
that wordpress uses a 'role' based authorization system. Therefore
assigning the 'administrator' role to a user should IMHO be enough to
have an administrator.
Note that the only place I could find where authorization is based on
the numeral '1' is in wp-admin/upgrade.php. All the other wp functions
use the roles and capabilities functionality, and therefore *every*
other administrative functions can be performed using a user with the
'administrator' role - *except* - for the upgrade process.
Unfortunately "current_user_can('administrator')" doesn't work.
Right... But I tried with "current_user_can('level_10')" and that seems
to work fine. Something like :
**
--- upgrade.php.orig2009-08-15 12:35:51.0 +0200
+++ upgrade.php 2009-08-15 12:27:25.0 +0200
@@ -21,6 +21,7 @@
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 1)
+ if(!current_user_can('level_10'))
wp_safe_redirect('../wp-login.php?upgrade');
timer_start();
**
works for me. Alternatively, the 'import' capability could be checked
instead since this entails the capacity to perform administrative
functions on the wp database.
Anyway.. No big deal for me. Whenever an upgrade is needed, I can always
make a quick change to wp-admin/upgrade.php.
--Ivan
smime.p7s
Description: S/MIME Cryptographic Signature
Bug#541371: wordpress: Unable to upgrade wp db with non-default admin
Hi Ivan,
Ivan Warren ha scritto:
> When an installation doesn't use or no longer has the default wordpress
> administrative user, the database upgrade cannot be initiated because
> the upgrade.php script checks if the current logged in user id is '1'
> instead of checking whether the logged in user has the 'administrator'
> role or capability.
Why an installation shouldn't have the default wordpress admin user?
> The symptom is that invoking the wp-admin/upgrade.php URL invariably
> redirects to wp-login.php?upgrade with the 'Upgrade is needed, please
> log in with the admin account.' yellow box message even if the user is
> an administrator but is not the 'default' wordpress administrator.
>
> One possible fix would be to invoke "current_user_can('administrator')"
> if it exists and the current user ID isn't 1 (since '1' is always the
> administrator, and a non '1' administrator implies capabilities exist in
> the wp table).
>
Unfortunately "current_user_can('administrator')" doesn't work.
Cheers,
Giuseppe.
signature.asc
Description: OpenPGP digital signature
Bug#541371: wordpress: Unable to upgrade wp db with non-default admin
Package: wordpress
Version: 2.8.3-2
Severity: important
When an installation doesn't use or no longer has the default wordpress
administrative user, the database upgrade cannot be initiated because
the upgrade.php script checks if the current logged in user id is '1'
instead of checking whether the logged in user has the 'administrator'
role or capability.
The symptom is that invoking the wp-admin/upgrade.php URL invariably
redirects to wp-login.php?upgrade with the 'Upgrade is needed, please
log in with the admin account.' yellow box message even if the user is
an administrator but is not the 'default' wordpress administrator.
One possible fix would be to invoke "current_user_can('administrator')"
if it exists and the current user ID isn't 1 (since '1' is always the
administrator, and a non '1' administrator implies capabilities exist in
the wp table).
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.29-1-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages wordpress depends on:
ii apache2 2.2.12-1Apache HTTP Server metapackage
ii apache2-mpm-prefork [htt 2.2.12-1Apache HTTP Server -
traditional n
ii libapache2-mod-php5 5.2.10.dfsg.1-2 server-side, HTML-embedded
scripti
ii libjs-jquery 1.3.3-1 JavaScript library for
dynamic web
ii libjs-prototype 1.6.0.3-1 JavaScript Framework for
dynamic w
ii libjs-scriptaculous 1.8.2-1 JavaScript library for
dynamic web
ii libphp-phpmailer 2.1-1 full featured email
transfer class
ii libphp-snoopy1.2.4-1 Snoopy is a PHP class that
simulat
ii mysql-client-5.1 [virtua 5.1.37-1MySQL database client binaries
ii php5 5.2.10.dfsg.1-2 server-side, HTML-embedded
scripti
ii php5-gd 5.2.10.dfsg.1-2 GD module for php5
ii php5-mysql 5.2.10.dfsg.1-2 MySQL module for php5
ii tinymce 3.2.1.1-0.1 platform independent web
based Jav
wordpress recommends no packages.
Versions of packages wordpress suggests:
ii mysql-server-5.1 [virtual-mys 5.1.37-1 MySQL database server binaries
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

