123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- define('INSTALLDIR', dirname(__FILE__, 2));
- define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
- $shortoptions = '';
- $longoptions = array();
- $helptext = <<<END_OF_UPDATEURLS_HELP
- updateuris.php [options]
- update stored user URIs in the system
- END_OF_UPDATEURLS_HELP;
- require_once INSTALLDIR.'/scripts/commandline.inc';
- function main()
- {
- updateUserUris();
- }
- function updateUserUris()
- {
- printfnq("Updating user URIs...\n");
- $user = new User();
- if ($user->find()) {
- while ($user->fetch()) {
- printfv("Updating user {$user->nickname}...");
- try {
- updateUserUri($user);
- } catch(Exception $e) {
- echo "\nError updating {$user->nickname} URI: " . $e->getMessage() . "\n";
- }
- printfv("DONE.\n");
- }
- }
- }
- function updateUserUri($user)
- {
- $orig = clone($user);
- $user->uri = common_user_uri($user);
- $user->updateWithKeys($orig);
- }
- main();
|