Exemplo n.º 1
0
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// INIT
define('PHOROMATIC_SERVER', true);
define('REMOTE_ACCESS', true);
// XXX TODO: Is this still used with new Phoromatic?
//ini_set('memory_limit', '64M');
define('PTS_MODE', 'WEB_CLIENT');
define('PTS_AUTO_LOAD_OBJECTS', true);
error_reporting(E_ALL);
include '../../pts-core.php';
pts_client::init();
$environmental_variables = array('aid' => 'ACCOUNT_ID', 'sid' => 'SYSTEM_ID', 'bid' => 'BENCHMARK_TICKET_ID', 'gsid' => 'GSID', 'a' => 'ACTIVITY', 'r' => 'REQUEST', 'pts' => 'CLIENT_VERSION', 'pts_core' => 'CLIENT_CORE_VERSION', 'h' => 'CLIENT_HARDWARE', 's' => 'CLIENT_SOFTWARE', 'i' => 'ID', 'o' => 'OTHER', 'nm' => 'NETWORK_CLIENT_MAC', 'nw' => 'NETWORK_CLIENT_WOL', 'n' => 'HOSTNAME', 'ti' => 'TEST_IDENTIFIER', 'ts' => 'TRIGGER_STRING', 'time' => 'ESTIMATED_TIME', 'pc' => 'PERCENT_COMPLETE', 'c' => 'COMPOSITE_XML', 'ob' => 'OPENBENCHMARKING_ID', 'sched' => 'SCHEDULE_ID', 'lip' => 'LOCAL_IP', 'j' => 'JSON', 'composite_xml' => 'COMPOSITE_XML', 'composite_xml_gz' => 'COMPOSITE_XML_GZ', 'composite_xml_hash' => 'COMPOSITE_XML_HASH', 'system_logs_zip' => 'SYSTEM_LOGS_ZIP', 'system_logs_hash' => 'SYSTEM_LOGS_HASH', 'msi' => 'PTS_MACHINE_SELF_ID', 'err' => 'ERROR_MSG', 'et' => 'ELAPSED_TIME');
foreach ($environmental_variables as $get_var => $to_var) {
    if (isset($_REQUEST[$get_var]) && !empty($_REQUEST[$get_var])) {
        ${$to_var} = $_REQUEST[$get_var];
    } else {
        ${$to_var} = null;
    }
}
if ($CLIENT_CORE_VERSION < 5312) {
    // Due to major PTS 5.4 development changes, client version bump will be necessary
    $json['phoromatic']['error'] = 'You must update your Phoronix Test Suite clients for compatibility with this Phoromatic server.';
    echo json_encode($json);
    exit;
}
// DATABASE SETUP
function phoromatic_init_web_page_setup()
{
    if (session_save_path() == null) {
        // This is needed since on at least EL6 by default there is no session_save_path set
        if (is_writable('/var/lib/php') && is_dir('/var/lib/php')) {
            session_save_path('/var/lib/php');
        } else {
            if (is_writable('/var/lib/php5') && is_dir('/var/lib/php5')) {
                session_save_path('/var/lib/php5');
            } else {
                session_save_path('/tmp');
            }
        }
    }
    define('PHOROMATIC_SERVER', true);
    error_reporting(E_ALL);
    session_start();
    define('PTS_MODE', 'WEB_CLIENT');
    define('PTS_AUTO_LOAD_OBJECTS', true);
    define('PHOROMATIC_USER_IS_VIEWER', !isset($_SESSION['AdminLevel']) || $_SESSION['AdminLevel'] >= 10 || $_SESSION['AdminLevel'] < 1 ? true : false);
    include '../../pts-core.php';
    pts_client::init();
}