Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
check_funnelback_setup.php
1 <?php
27 if (php_sapi_name() != 'cli') {
28  trigger_error('This script can only be run from the command line', E_USER_ERROR);
29  exit();
30 }//end if
31 
32 $SYSTEM_ROOT = ((isset($_SERVER['argv'][1])) ? $_SERVER['argv'][1] : '');
33 if (empty($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT)) {
34  trigger_error('You need to specify a path to Matrix as the first parameter', E_USER_ERROR);
35  exit();
36 }//end if
37 
38 define('SQ_SYSTEM_ROOT', $SYSTEM_ROOT);
39 require_once SQ_SYSTEM_ROOT.'/core/include/init.inc';
40 
41 // Check the script is being run from same user as apache
42 $apache_user = fileowner(SQ_SYSTEM_ROOT.'/data/private/conf/main.inc');
43 $current_user = array_get_index($_ENV, 'USER', '');
44 
45 if ($apache_user != $current_user) {
46 // trigger_error('This script needs to run as the apache user', E_USER_ERROR);
47 // exit();
48 }//end if
49 
50 $funnelback_manager = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('funnelback_manager');
51 
52 // Check the base install for paths and permissions
53 $valid = $funnelback_manager->checkInstalled();
54 
55 if ($valid) {
56  echo "Looks ok from here\n";
57 } else {
58  echo "Funnelback has not been installed correctly\n";
59 }//end if
60 
61 exit();
62 ?>