function all_releases() { static $releases; if ($releases != null) { return $releases; } $releases = dirname(site_base()); $releases = glob($releases . '/*'); if (count($releases)) { $realReleases = array(); foreach ($releases as $releaseName) { if (preg_match('/\\d{14}$/', $releaseName) && $releaseName != site_base()) { $realReleases[] = $releaseName; } } $releases = $realReleases; } rsort($releases); return $releases; }
<?php include_once dirname(__FILE__) . '/deploy_helpers.php'; $oldPath = old_path(); $MYSITE_BASE = mysite_base(); // handles static cache output dir if ($oldPath && is_dir("{$oldPath}/cache")) { $cache = "{$oldPath}/cache"; $to = site_base(); $cmd = "cp -R {$cache} {$to}"; $cmds[] = $cmd; `{$cmd}`; } // handles xhprof config if it exists $xhprof_dir = $MYSITE_BASE . '/thirdparty/xhprof'; if (is_dir($xhprof_dir)) { $cwd = getcwd(); chdir($xhprof_dir . '/xhprof_lib/utils'); if (!file_exists('xhprof_runs.php')) { $path_to_link = 'xhprof_runs_mysql.php'; $cmd = "ln -s {$path_to_link} xhprof_runs.php"; $cmds[] = $cmd; `{$cmd}`; } chdir($cwd); if ($oldPath) { $xhprof_config = $oldPath . '/mysite/thirdparty/xhprof/xhprof_lib/config.php'; if (file_exists($xhprof_config)) { $cmds[] = "copy {$xhprof_config} {$xhprof_dir}"; copy($xhprof_config, $xhprof_dir . '/xhprof_lib/config.php'); }
<?php include_once dirname(__FILE__) . '/deploy_helpers.php'; $cwd = getcwd(); $SITE_BASE = site_base(); $MYSITE_BASE = mysite_base(); $cmds = array(); // clean up combined files - may need to have this configurable $combined_base = $SITE_BASE . '/assets/_combinedfiles'; if (is_dir($combined_base)) { $files = glob($combined_base . '/*.js'); foreach ($files as $j) { $cmds[] = "unlink {$j}"; unlink($j); } $files = glob($combined_base . '/*.css'); foreach ($files as $c) { $cmds[] = "unlink {$c}"; unlink($c); } } global $SYNC_SCRIPT; // run the rsync of code changes immediately if ($SYNC_SCRIPT && file_exists($SYNC_SCRIPT)) { $cmds[] = $SYNC_SCRIPT; `{$SYNC_SCRIPT}`; } // now apc clear - relies on apache .htaccess denial for .php scripts except those // triggered from allowed hosts - in this case localhost if (file_exists($MYSITE_BASE . '/apc_clear.php')) { $url = 'http://localhost/' . Director::baseURL() . '/mysite/apc_clear.php';