| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
/** |
| 10 |
* Provide uninstall functions |
| 11 |
* required for cleaning up the installation |
| 12 |
* process! |
| 13 |
* |
| 14 |
* @author CJT-Team |
| 15 |
*/ |
| 16 |
class CJTUninstallModel { |
| 17 |
|
| 18 |
/** |
| 19 |
* put your comment there... |
| 20 |
* |
| 21 |
*/ |
| 22 |
public function database() { |
| 23 |
// Import dependencies. |
| 24 |
cssJsToolbox::import('framework:installer:dbfile.class.php'); |
| 25 |
// Load Uninstallation SQL Statements! |
| 26 |
CJTDBFileInstaller::getInstance(cssJsToolbox::resolvePath('models:uninstall:db:mysql:uninstall.sql.php')) |
| 27 |
// Execute All, |
| 28 |
->exec(); |
| 29 |
// Chaining! |
| 30 |
return $this; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* put your comment there... |
| 35 |
* |
| 36 |
*/ |
| 37 |
public function expressUninstall() { |
| 38 |
// Clean up database |
| 39 |
$this->database(); |
| 40 |
// Clean up file system! |
| 41 |
$this->fileSystem(); |
| 42 |
// Chaining! |
| 43 |
return $this; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* put your comment there... |
| 48 |
* |
| 49 |
*/ |
| 50 |
public function fileSystem() { |
| 51 |
global $wp_filesystem; |
| 52 |
// Getting directory list! |
| 53 |
$wpContentDir = WP_CONTENT_DIR; |
| 54 |
$fSConfig = cssJSToolbox::$config->fileSystem; |
| 55 |
// Directories to create! |
| 56 |
$directories = array( |
| 57 |
"{$wpContentDir}/{$fSConfig->contentDir}", |
| 58 |
"{$wpContentDir}/{$fSConfig->contentDir}/{$fSConfig->templatesDir}", |
| 59 |
); |
| 60 |
// Delete all directories! |
| 61 |
foreach ($directories as $dir) { |
| 62 |
$wp_filesystem->delete($dir, true); |
| 63 |
} |
| 64 |
// Chaining! |
| 65 |
return $this; |
| 66 |
} |
| 67 |
|
| 68 |
} // End class. |