root/devel-backup/upgrade.php

Revision 170, 1.6 kB (checked in by ben, 3 years ago)

Template creation now works, upgrade.php altered to handle files with incorrect paths

  • Property svn:eol-style set to native
Line 
1 <?php
2
3     // Upgrade script
4
5     // Display errors
6         error_reporting(E_ERROR | E_WARNING | E_PARSE);
7     
8     // Set time limit to 20 minutes
9         @set_time_limit (1200);
10     
11     // Require main includes
12         @require("includes.php");
13         
14     // Display message
15         echo "<h1>" . gettext("Upgrading ...") . "</h1>";
16         
17     // Alter file repository to remove path information
18         echo "<h2>" . gettext("Adjusting file repository information") . "</h2>";
19         
20     // Get all files with path in the location
21         $files = db_query("select ident, location from files where location like \"".path."%\"");
22         
23     // If we have any...
24         if ($files != false && sizeof($files) > 0) {
25             foreach ($files as $file) {
26                 
27                 $ident = $file->ident;
28                 $filename = str_replace(path, "", $file->location);
29                 
30                 db_query("update files set location = '$filename' where ident = $ident");
31                 echo "<p>" . sprintf(gettext("Updating file %d: %s"),$ident,$filename) . "</p>";
32                 
33             }
34         }
35         
36     // Publish RSS
37         echo "<h2>" . gettext("Publishing RSS") . "</h2>";
38         
39     // Get all users
40         
41         $users = db_query("select ident from users");
42         
43     // Iterate through them, publishing their RSS files
44         
45         foreach($users as $user) {
46     
47             $ident = $user->ident;
48             
49             echo "<p>" . sprintf(gettext("Publishing RSS for user %d"),$ident) . "</p>";
50             
51             $rssresult = run("weblogs:rss:publish", array($ident, false));
52             $rssresult = run("files:rss:publish", array($ident, false));
53             $rssresult = run("profile:rss:publish", array($ident, false));
54             
55         }
56         
57     // Display finishing message
58
59         echo "<hr />";
60         echo "<p>" . gettext("Done. You must now delete upgrade.php from your root Elgg folder.") . "</p>";
61     
62 ?>
Note: See TracBrowser for help on using the browser.