]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merged r6506:6509 from 1.7 to trunk.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 18 Jun 2010 21:19:11 +0000 (21:19 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 18 Jun 2010 21:19:11 +0000 (21:19 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6516 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/upgrades/2010061501.php [new file with mode: 0644]
engine/lib/views.php
engine/start.php
mod/groups/actions/invite.php
version.php

diff --git a/engine/lib/upgrades/2010061501.php b/engine/lib/upgrades/2010061501.php
new file mode 100644 (file)
index 0000000..19d6467
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+/**
+ * utf8 conversion and file merging for usernames with multibyte chars
+ * 
+ */
+
+
+// check that we need to do the utf8 conversion
+// C&P logic from 2010033101
+set_time_limit(0);
+$dbversion = (int) datalist_get('version');
+
+if ($dbversion < 2009100701) {
+       // start a new link to the DB to see what its defaults are.
+       $link = mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass, TRUE);
+       mysql_select_db($CONFIG->dbname, $link);
+       
+       $q = "SHOW VARIABLES LIKE 'character_set_client'";
+       $r = mysql_query($q);
+       $client = mysql_fetch_assoc($r);
+       
+       $q = "SHOW VARIABLES LIKE 'character_set_connection'";
+       $r = mysql_query($q);
+       $connection = mysql_fetch_assoc($r);
+       
+       // only run upgrade if not already talking utf8
+       if ($client['Value'] != 'utf8' && $connection['Value'] != 'utf8') {
+               $qs = array();
+               $qs[] = "SET NAMES utf8";
+       
+               $qs[] = "ALTER TABLE {$CONFIG->dbprefix}users_entity DISABLE KEYS";
+               $qs[] = "REPLACE INTO {$CONFIG->dbprefix}users_entity (guid, name, username, password, salt, email, language, code,
+               banned, last_action, prev_last_action, last_login, prev_last_login)
+                       SELECT guid, name, unhex(hex(convert(username using latin1))), password, salt, email, language, code,
+                               banned, last_action, prev_last_action, last_login, prev_last_login
+                       FROM {$CONFIG->dbprefix}users_entity";
+               
+               $qs[] = "ALTER TABLE {$CONFIG->dbprefix}users_entity ENABLE KEYS";
+       
+               foreach ($qs as $q) {
+                       if (!update_data($q)) {
+                               throw new Exception('Couldn\'t execute upgrade query: ' . $q);
+                       }
+               }
+       
+               global $DB_QUERY_CACHE, $DB_PROFILE, $ENTITY_CACHE;
+               
+               /**
+                       Upgrade file locations
+                */
+               // new connection to force into utf8 mode to get the old name
+               $link = mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass, TRUE);
+               mysql_select_db($CONFIG->dbname, $link);
+               
+               // must be the first command
+               mysql_query("SET NAMES utf8");
+               
+               $users = mysql_query("SELECT guid, username FROM {$CONFIG->dbprefix}users_entity WHERE username != ''", $link);
+               while ($user = mysql_fetch_object($users)) {
+                       $DB_QUERY_CACHE = $DB_PROFILE = $ENTITY_CACHE = array();
+               
+                       $to = $CONFIG->dataroot . user_file_matrix($user->guid);
+                       foreach (array('1_0', '1_1', '1_6') as $version) {
+                               $function = "file_matrix_$version";
+                               $from = $CONFIG->dataroot . $function($user->username);
+                               merge_directories($from, $to, $move=TRUE, $preference='from');
+                       }
+               }
+       }
+}
\ No newline at end of file
index b7dc2016c784f626f5922072f05d3514d2152c1c..035038641f62e14f0c80bdf5913ab9b0f220edbe 100644 (file)
@@ -400,6 +400,9 @@ function elgg_view_regenerate_simplecache($viewtype = NULL) {
 
        elgg_set_viewtype($original_viewtype);
 
+       // needs to be set for links in html head
+       $CONFIG->lastcache = $lastcached;
+
        unset($CONFIG->pagesetupdone);
 }
 
index d31090427a1bca56727a8f0a6d988d99b1678c8a..442222dc80d4c8664cf336a9c54d8e5a6c2f6d53 100644 (file)
@@ -141,4 +141,6 @@ if (($installed) && ($db_installed) && !(defined('upgrading') && upgrading == 'u
        if ($lastupdate == 0 || $lastcached < $lastupdate) {
                elgg_view_regenerate_simplecache($oldview);
        }
+       // needs to be set for links in html head
+       $CONFIG->lastcache = $lastcached;
 }
index d2fd75c28dc79eed21b08e3714afb4eeba18cff9..ba63b8e14ab4439e39dd20e9b3a36a99009ed69e 100644 (file)
@@ -31,7 +31,7 @@ if (sizeof($user_guid))
 
                if ( $user && $group) {
 
-                       if (get_loggedin_userid() == $group->owner_guid)
+                       if (($group instanceof ElggGroup) && ($group->canEdit()))
                        {
                                if (!check_entity_relationship($group->guid, 'invited', $user->guid))
                                {
index 11a678d5bc8a98a6172fdfa816ad92c14afa0d11..6fc5f8f5049dc1caae254fec35a94761e76774dd 100644 (file)
@@ -12,7 +12,7 @@
 
 // YYYYMMDD = Elgg Date
 // XX = Interim incrementer
-$version = 2010060401;
+$version = 2010061501;
 
 // Human-friendly version name
 $release = '1.8-svn';