PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / 1.4.3
JetBackup – Backup, Restore & Migrate v1.4.3
3.1.22.3 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.8.1 1.4.9 1.5.0 1.5.1 1.5.1.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.10 1.6.11 1.6.12 1.6.13 1.6.15 1.6.5.1 1.6.8.8 1.6.9 1.6.9.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7.5 2.0.8.7 2.0.9.11 2.0.9.14 2.0.9.15 2.0.9.6 2.0.9.7 2.0.9.9 3.1.10.7 3.1.11.1 3.1.12.3 3.1.13.4 3.1.14.17 3.1.15.4 3.1.16.1 3.1.17.5 3.1.18.10 3.1.18.8 3.1.18.9 3.1.19.8 3.1.20.3 3.1.21.3 3.1.7.9 3.1.9.2 trunk 1.1.90 1.1.91 1.2.0 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2
backup / com / core / extension / SGExtensionAdapterWordpress.php
backup / com / core / extension Last commit date
SGExtension.php 5 years ago SGExtensionAdapterWordpress.php 5 years ago SGIExtensionAdapter.php 5 years ago
SGExtensionAdapterWordpress.php
80 lines
1 <?php
2
3 require_once(dirname(__FILE__).'/SGIExtensionAdapter.php');
4
5 class SGExtensionAdapterWordpress implements SGIExtensionAdapter
6 {
7 public function isExtensionActive($extension)
8 {
9 return is_plugin_active($extension."/".$extension.".php");
10 }
11
12 public function isExtensionAvailable($extension)
13 {
14 return file_exists(SG_EXTENSIONS_FOLDER_PATH.$extension);
15 }
16
17 public function isExtensionAlreadyInPluginsFolder($extension)
18 {
19 return file_exists(WP_PLUGIN_DIR."/".$extension);
20 }
21
22 public function installExtension($extension)
23 {
24 if (!$this->isExtensionAlreadyInPluginsFolder($extension)) {
25 return $this->copyExtensionFilesToPLuginsFolder($extension);
26 }
27
28 return false;
29 }
30
31 public function activateExtension($extension)
32 {
33 SGConfig::set($extension, 1);
34 if (!$this->isExtensionActive($extension)) {
35 activate_plugin($extension."/".$extension.".php");
36 }
37 }
38
39 public function copyExtensionFilesToPLuginsFolder($extension)
40 {
41 $extensionsDirectoryPath = SG_EXTENSIONS_FOLDER_PATH.$extension;
42 if (!$this->isExtensionAvailable($extension)) {
43 return false;
44 }
45
46 $pluginsDirectoryPath = WP_PLUGIN_DIR."/".$extension;
47 @mkdir($pluginsDirectoryPath, 0755, true);
48
49 $it = new RecursiveIteratorIterator(
50 new RecursiveDirectoryIterator($extensionsDirectoryPath, RecursiveDirectoryIterator::SKIP_DOTS),
51 RecursiveIteratorIterator::SELF_FIRST,
52 RecursiveIteratorIterator::CATCH_GET_CHILD
53 );
54
55 foreach ($it as $path => $fileInfo) {
56 $filename = $fileInfo->getFilename();
57 if ($filename == '.DS_Store') {
58 continue;
59 }
60
61 $relativePath = substr($path, strlen($extensionsDirectoryPath));
62
63 if (substr($relativePath, 0, 4) == '.git') {
64 continue;
65 }
66
67 if ($fileInfo->isDir()) {
68 @mkdir($pluginsDirectoryPath.$relativePath, 0755, true);
69 }
70 else {
71 if (!@copy($path, $pluginsDirectoryPath.$relativePath)) {
72 return false;
73 }
74 }
75 }
76
77 return true;
78 }
79 }
80