PluginProbe
wp-forecast / 2.8
wp-forecast v2.8
10.0 trunk 1.4 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3..5 3..8 3.0 3.1 3.2 3.3 3.4 3.6 All 86 releases
wp-forecast / wpf_autoupdate.php

wpf_autoupdate.php in wp-forecast 2.8, at wpf_autoupdate.php

75 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /* This file is part of the wp-monalisa plugin for wordpress */
4
5 /* Copyright 2010 Hans Matzen (email : webmaster at tuxlog.de)
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
23 function hm_backup_wpf()
24 {
25 global $wp_filesystem;
26
27 // name for backup directory
28 $backupdir = $wp_filesystem->wp_content_dir()."/upgrade/wpf_update/";
29
30 // wenn vorhanden, altes backup verzeichnis löschen
31 if (is_dir($backupdir)) {
32 $wp_filesystem->delete($backupdir,true);
33 }
34
35 // backupdir anlegen
36 $wp_filesystem->mkdir($backupdir);
37
38 // individuelle css datei sichern
39 if ($wp_filesystem->is_file(dirname(__FILE__)."/wp-forecast.css"))
40 $wp_filesystem->copy(dirname(__FILE__)."/wp-forecast.css",
41 $backupdir."/wp-forecast.css");
42
43 // individuelle css datei sichern
44 if ($wp_filesystem->is_file(dirname(__FILE__)."/wp-forecast-nowp.css"))
45 $wp_filesystem->copy(dirname(__FILE__)."/wp-forecast-nowp.css",
46 $backupdir."/wp-forecast-nowp.css");
47
48 }
49
50 function hm_recover_wpf()
51 {
52 global $wp_filesystem;
53
54 $backupdir = $wp_filesystem->wp_content_dir()."/upgrade/wpf_update/";
55 $pdir = dirname(__FILE__);
56
57 // individuelle css datei zurück holen
58 if ($wp_filesystem->is_file($backupdir."/wp-forecast.css"))
59 $wp_filesystem->copy( $backupdir."/wp-forecast.css",
60 $pdir."/wp-forecast.css");
61
62 // individuelle css datei zurück holen
63 if ($wp_filesystem->is_file($backupdir."/wp-forecast-nowp.css"))
64 $wp_filesystem->copy( $backupdir."/wp-forecast-nowp.css",
65 $pdir."/wp-forecast-nowp.css");
66
67 // backup verzeichnis löschen
68 $wp_filesystem->delete($backupdir,true);
69 }
70
71 // add filter
72 add_filter('upgrader_pre_install' , 'hm_backup_wpf' , 10, 2);
73 add_filter('upgrader_post_install', 'hm_recover_wpf', 10, 2);
74
75 ?>