check file exists
[Pman.Core] / UpdateDatabase / VerifyExtensions.php
1 <?php
2
3 require_once 'Pman.php';
4
5 class Pman_Core_UpdateDatabase_VerifyExtensions extends Pman
6 {
7     static $cli_opts = array(
8
9     );
10     
11     function getAuth()
12     {
13         if ($_SERVER['HTTP_HOST'] == 'localhost') {
14             return true;
15         }
16         
17         $this->getAuthUser();
18         
19         if(empty($this->authUser)) {
20             return false;
21         }
22         
23         return true;
24     }
25     
26     function get($base, $opts = array())
27     {
28         $extensions = array();
29         
30         $ff = HTML_FlexyFramework::get();
31         
32         foreach($this->modulesList() as $m) {
33             
34             $fd = $ff->rootDir. "/Pman/$m/UpdateDatabase.php";
35             
36             if (!file_exists($fd)) {
37                 continue;
38             }
39             require_once $fd;
40             $cls = new ReflectionClass('Pman_'. $m . '_UpdateDatabase');
41             $props = $cls->getDefaultProperties();
42             
43             if(!empty($props['required_extensions'])) {
44                 $extensions = array_merge($extensions, $props['required_extensions']);
45             }
46         }
47         
48         $error = '';
49         
50         foreach ($extensions as $e){
51             
52             if(empty($e) || extension_loaded($e)) {
53                 continue;
54             }
55             
56             $error .= "$e\n";
57         }
58         
59         if(!empty($error)) {
60             $this->jerror(false,$error);
61         }
62         
63         $this->jok("DONE");
64         
65     }
66 }