Skip to content

Instantly share code, notes, and snippets.

@ichigotake
Created September 17, 2012 07:36
Show Gist options
  • Select an option

  • Save ichigotake/3736040 to your computer and use it in GitHub Desktop.

Select an option

Save ichigotake/3736040 to your computer and use it in GitHub Desktop.
SetucoCMSで動作環境のチェックをするページ
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
//Define SetucoCMS version
defined('APPLICATION_VERSION') || define('APPLICATION_VERSION', '0.1.0');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
/*
$app_ini = APPLICATION_PATH . '/configs/application.ini';
if(!file_exists($app_ini)) {
}
*/
$view = new Zend_View();
$allOk = true;
$requiredOk = true;
$dirErrors = array();
if (!Setuco_Util_Media::isWritableUploadDir()) {
$dirErrors[] = Setuco_Data_Constant_Media::MEDIA_UPLOAD_DIR_FULLPATH() . ' が存在しないか、書き込みできません。';
}
if (!Setuco_Util_Media::isWritableThumbDir()) {
$dirErrors['upload_thumb'] = Setuco_Data_Constant_Media::MEDIA_THUMB_DIR_FULLPATH() . ' が存在しないか、書き込みできません。';
}
if (!Setuco_Util_Config::isWritableConfigDir()) {
$dirErrors['configs'] = Setuco_Data_Constant_Config::CONFIG_DIR_FULLPATH() . ' が存在しないか、書き込みできません。';
}
if (count($dirErrors) > 0) {
$view->assign('dirErrors', $dirErrors);
}
$requiredPhpExtensions = Setuco_Util_Environment::checkRequiredPhpExtensions();
foreach ($requiredPhpExtensions as $ext => $loaded) {
if (!$loaded) {
$allOk = false;
$requiredOk = false;
}
}
$view->assign('phpExtensions', $requiredPhpExtensions);
$requiredApacheModules = Setuco_Util_Environment::checkRequiredApacheModules();
foreach ($requiredApacheModules as $module => $loaded) {
if (!$loaded) {
$all_ok = false;
$required_ok = false;
}
}
$view->assign('apacheModules', $requiredApacheModules);
$view->assign('allOk', $allOk);
$view->assign('requiredOk', $requiredOk);
//$view->setLayout('');
$view->setScriptPath(APPLICATION_PATH . '/modules/install/views/scripts/check/');
$view->assign('baseUrl', function($path) { return '/SetucoCMS/public'. $path;});
$layout = new Zend_Layout();
$layout->setLayoutPath(APPLICATION_PATH . '/modules/install/views/layouts/');
$layout->content = $view->render('index.phtml');
$content = $layout->render();
//todo baseUrlヘルパーを利用
$content = str_replace('/css', '/SetucoCMS/public/css', $content);
$content = str_replace('/images', '/SetucoCMS/public/images', $content);
echo $content;
function __autoload($classname = '')
{
$path = str_replace('_', '/', $classname) . '.php';
require_once($path);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment