PluginProbe
wp-forecast / 9.6
wp-forecast v9.6
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 9.6, at wpf-autoupdate.php

93 lines 2.6 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 * @package wp-forecast
22 */
23
24 /**
25 * Backup the files changed by the user
26 */
27 function hm_backup_wpf() {
28 global $wp_filesystem;
29
30 // name for backup directory.
31 $backupdir = $wp_filesystem->wp_content_dir() . '/upgrade/wpf_update/';
32
33 // wenn vorhanden, altes backup verzeichnis löschen.
34 if ( is_dir( $backupdir ) ) {
35 $wp_filesystem->delete( $backupdir, true );
36 }
37
38 // backupdir anlegen.
39 $wp_filesystem->mkdir( $backupdir );
40
41 // individuelle css datei sichern.
42 if ( $wp_filesystem->is_file( dirname( __FILE__ ) . '/wp-forecast.css' ) ) {
43 $wp_filesystem->copy(
44 dirname( __FILE__ ) . '/wp-forecast.css',
45 $backupdir . '/wp-forecast.css'
46 );
47 }
48
49 // individuelle css datei sichern.
50 if ( $wp_filesystem->is_file( dirname( __FILE__ ) . '/wp-forecast-nowp.css' ) ) {
51 $wp_filesystem->copy(
52 dirname( __FILE__ ) . '/wp-forecast-nowp.css',
53 $backupdir . '/wp-forecast-nowp.css'
54 );
55 }
56
57 }
58
59 /**
60 * Restoer files changed by the user
61 */
62 function hm_recover_wpf() {
63 global $wp_filesystem;
64
65 $backupdir = $wp_filesystem->wp_content_dir() . '/upgrade/wpf_update/';
66 $pdir = dirname( __FILE__ );
67
68 // individuelle css datei zurück holen.
69 if ( $wp_filesystem->is_file( $backupdir . '/wp-forecast.css' ) ) {
70 $wp_filesystem->copy(
71 $backupdir . '/wp-forecast.css',
72 $pdir . '/wp-forecast.css'
73 );
74 }
75
76 // individuelle css datei zurück holen.
77 if ( $wp_filesystem->is_file( $backupdir . '/wp-forecast-nowp.css' ) ) {
78 $wp_filesystem->copy(
79 $backupdir . '/wp-forecast-nowp.css',
80 $pdir . '/wp-forecast-nowp.css'
81 );
82 }
83
84 // backup verzeichnis löschen.
85 $wp_filesystem->delete( $backupdir, true );
86 }
87
88 // add filter.
89 add_filter( 'upgrader_pre_install', 'hm_backup_wpf', 10, 2 );
90 add_filter( 'upgrader_post_install', 'hm_recover_wpf', 10, 2 );
91
92
93