]> andersk Git - sql-web.git/blame - tpl/index.php
minor portability fixes
[sql-web.git] / tpl / index.php
CommitLineData
997305cf 1<?php
dc478ec8 2include 'head.php';
377015e0 3?>
1389493c
JP
4
5<p>
49ea14ad 6This service provides <a target="_blank" href="http://dev.mysql.com/doc">MySQL</a> databases to <a target="_blank" href="http://ca.mit.edu/">MIT certificate</a> holders.
79ffa771 7You must choose a MySQL password (which should be different from your Athena account password) when you <a href="do/signup">sign up</a>, and
f9f86182 8then use this interface to create and drop databases. All subsequent SQL commands can be issued from any host, client, and/or script of your choice;
690e37fb
JP
9simply connect to the MySQL server at <b>sql.mit.edu</b> using your username and your new MySQL password.
10You may find it convenient to run scripts using the <a target="_blank" href="http://scripts.mit.edu/web">web script service</a> or
49ea14ad 11<a target="_blank" href="http://scripts.mit.edu/cron">shortjobs service</a>.
f9f86182
JP
12</p>
13
14<p>
49ea14ad 15All uses of this service must comply with the <a target="_blank" href="http://web.mit.edu/olh/Welcome/rules.html">MITnet rules of use</a>.
1389493c
JP
16</p>
17
1389493c 18<p>
8835695c
JP
19This service has been designed with reliability in mind; we utilize RAID, live server mirroring and periodic offline backups to ensure data reliability.
20However, the SIPB MySQL service should not be used to host critical applications that cannot tolerate downtime.
21One nightly backup is available for your locker at <code>/mit/sql/backup/LOCKER_NAME</code>. You should perform additional backups of your data using the <a href="http://scripts.mit.edu/cron">shortjobs service</a> or <a href="http://scripts.mit.edu/faq/10/how-can-i-back-up-or-restore-my-sql-data">phpMyAdmin</a>.
1389493c
JP
22</p>
23
396061c0
JP
24<div style="text-align:center; font-style: italic;">
25<?php
7654fe78 26if (!file_exists(TEMP_PATH.'/stat') || filemtime(TEMP_PATH.'/stat')+3600<time()) {
396061c0
JP
27 $x = fetchRows(DBSelect("SHOW STATUS WHERE Variable_name IN ('Questions','Uptime')"),'Variable_name');
28 $v = $x['Questions']['Value'];
29 $t = $x['Uptime']['Value'];
7654fe78 30 file_put_contents(TEMP_PATH.'/stat',implode("\n",array($v,$t)));
396061c0 31} else {
7654fe78 32 $x = file_get_contents(TEMP_PATH.'/stat');
396061c0
JP
33 list($v, $t) = explode("\n", $x);
34}
35$qavg = $v/$t;
36$qunits = array('','k','M','G','T','P','E','Z','Y');
37while (count($qunits) && $v/1000>1) {
38 array_shift($qunits);
39 $v /= 1000;
40}
41printf('sql.mit.edu has served %.3f%s queries', $v, array_shift($qunits));
42
43$qunits = array('minutes', 'hours', 'days');
44$qdiv = array(60, 60, 24);
45while (count($qdiv) && $t/$qdiv[0]>0) {
46 $t /= array_shift($qdiv);
47 $tunits = array_shift($qunits);
48}
49printf(' in the last %.2f %s (%.2f qps)', $t, $tunits, $qavg);
50?>
51</div>
52
1389493c 53<?php
dc478ec8 54include 'foot.php';
201253ba 55?>
This page took 0.048431 seconds and 5 git commands to generate.