Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-12-18 14:14:48 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-12-18 14:14:48 (GMT)
commit82740196d586ecc1113eeb0b74b6e405a0f8f8e7 (patch)
tree6525d545f691a6a21dc7820ded869aabb9f34e43
parentccabc6ce362e75c973525ea14740c0b7802f90c7 (diff)
Add db-check.php
-rwxr-xr-xaslo/cron/daily-recount1
-rwxr-xr-xaslo/db-check.php45
2 files changed, 46 insertions, 0 deletions
diff --git a/aslo/cron/daily-recount b/aslo/cron/daily-recount
index d0666d8..3acc6b3 100755
--- a/aslo/cron/daily-recount
+++ b/aslo/cron/daily-recount
@@ -28,3 +28,4 @@ php -f maintenance.php share_count_totals
php -f maintenance.php category_totals
php -f ../aslo/files-check-missed.php
+php -f ../aslo/db-check.php
diff --git a/aslo/db-check.php b/aslo/db-check.php
new file mode 100755
index 0000000..6a376d4
--- /dev/null
+++ b/aslo/db-check.php
@@ -0,0 +1,45 @@
+<?php
+
+// Before doing anything, test to see if we are calling this from the command
+// line. If this is being called from the web, HTTP environment variables will
+// be automatically set by Apache. If these are found, exit immediately.
+if (isset($_SERVER['HTTP_HOST'])) {
+ exit;
+}
+
+require_once('database.class.php');
+
+// New database class
+$db = new Database();
+
+$sql = "
+ SELECT
+ a.id
+ FROM
+ addons as a
+ WHERE
+ 0 = (select count(*) from translations as t where t.id=a.name and t.locale=a.defaultlocale)
+ AND a.status=4
+";
+
+$rows = $db->read($sql);
+
+while ($row = mysql_fetch_array($rows)) {
+ debug("Missed name for default locale id={$row['id']}", true);
+}
+
+/**
+ * Give this function your output. If the debug flag (in the database) is set or if the error is serious it will get printed
+ *
+ * @param string what to print
+ * @param boolean if the error is fatal or not
+ */
+function debug($msg, $serious=false) {
+ if (CRON_DEBUG || $serious) {
+ $_ts = strftime('%H:%M:%S');
+ echo "{$_ts} {$msg}\n";
+ }
+}
+
+exit;
+?>