]> git.mxchange.org Git - friendica.git/blobdiff - update.php
Merge pull request #2190 from annando/1512-getload
[friendica.git] / update.php
index 954993a70a0f6ed59e4c372cff84902294ea62b5..caa167617cd7abf9a2f9c3cf8808484c69880f54 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1180 );
+define( 'UPDATE_VERSION' , 1191 );
 
 /**
  *
@@ -1640,3 +1640,86 @@ function update_1178() {
 
        return UPDATE_SUCCESS;
 }
+
+function update_1180() {
+
+       // Fill the new fields in the term table.
+       proc_run('php',"include/tagupdate.php");
+
+       return UPDATE_SUCCESS;
+}
+
+function update_1188() {
+
+       if (strlen(get_config('system','directory_submit_url')) AND
+               !strlen(get_config('system','directory'))) {
+               set_config('system','directory', dirname(get_config('system','directory_submit_url')));
+               del_config('system','directory_submit_url');
+       }
+
+       return UPDATE_SUCCESS;
+}
+
+function update_1190() {
+
+       require_once('include/plugin.php');
+
+       set_config('system', 'maintenance', 1);
+
+       if (plugin_enabled('forumlist')) {
+               $plugin = 'forumlist';
+               $plugins = get_config('system','addon');
+               $plugins_arr = array();
+
+               if($plugins) {
+                       $plugins_arr = explode(",",str_replace(" ", "",$plugins));
+
+                       $idx = array_search($plugin, $plugins_arr);
+                       if ($idx !== false){
+                               unset($plugins_arr[$idx]);
+                               //delete forumlist manually from addon and hook table 
+                               // since uninstall_plugin() don't work here
+                               q("DELETE FROM `addon` WHERE `name` = 'forumlist' ");
+                               q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' ");
+                               set_config('system','addon', implode(", ",$plugins_arr));
+                       }
+               }
+       }
+
+       // select old formlist addon entries
+       $r = q("SELECT `uid`, `cat`, `k`, `v` FROM `pconfig` WHERE `cat` = '%s' ",
+               dbesc('forumlist')
+       );
+
+       // convert old forumlist addon entries in new config entries
+       if (count($r)) {
+               foreach ($r as $rr) {
+                       $uid = $rr['uid'];
+                       $family = $rr['cat'];
+                       $key = $rr['k'];
+                       $value = $rr['v'];
+
+                       if ($key === 'randomise')
+                               del_pconfig($uid,$family,$key);
+
+                       if ($key === 'show_on_profile') {
+                               if ($value)
+                                       set_pconfig($uid,feature,forumlist_profile,$value);
+
+                               del_pconfig($uid,$family,$key);
+                       }
+
+                       if ($key === 'show_on_network') {
+                               if ($value)
+                                       set_pconfig($uid,feature,forumlist_widget,$value);
+
+                               del_pconfig($uid,$family,$key);
+                       }
+               }
+       }
+
+       set_config('system', 'maintenance', 0);
+
+       return UPDATE_SUCCESS;
+
+}