[xiph-commits] r14693 - in branches/dir.xiph.org: . cronjobs inc
balbinus at svn.xiph.org
balbinus at svn.xiph.org
Thu Apr 10 09:43:32 PDT 2008
Author: balbinus
Date: 2008-04-10 09:43:31 -0700 (Thu, 10 Apr 2008)
New Revision: 14693
Modified:
branches/dir.xiph.org/
branches/dir.xiph.org/cronjobs/generate_top.php
branches/dir.xiph.org/inc/inc.db.php
branches/dir.xiph.org/inc/prepend.php
branches/dir.xiph.org/index.php
Log:
Setting up for a test environment + svn:ignore.
Property changes on: branches/dir.xiph.org
___________________________________________________________________
Name: svn:ignore
+ .svnignore
yp.xml
c_templates
Modified: branches/dir.xiph.org/cronjobs/generate_top.php
===================================================================
--- branches/dir.xiph.org/cronjobs/generate_top.php 2008-04-10 15:29:14 UTC (rev 14692)
+++ branches/dir.xiph.org/cronjobs/generate_top.php 2008-04-10 16:43:31 UTC (rev 14693)
@@ -16,51 +16,8 @@
// How many streams will appear on the homepage
define('MAX_STREAMS_ON_HOMEPAGE', 20);
-// Clusters
-// ORDER BY `listeners` DESC LIMIT %d --> this was removed since it triggered temporary
-// + filesort total loser combo.
-/*try
-{
- $query = 'SELECT CONCAT("c", c.`id`) AS `id`, "cluster" AS `type`, m.`stream_name`, m.`description`, m.`genre`, SUM(m.`listeners`) AS `listeners`, m.`url`, m.`current_song`, m.`media_type`, m.`bitrate`, m.`channels` FROM `mountpoints` AS m LEFT JOIN `clusters` AS c ON m.`cluster_id` = c.`id` WHERE `listeners` > %d AND m.`cluster_id` IS NOT NULL GROUP BY m.`cluster_id`;';
- $query = sprintf($query, MIN_LISTENERS_FOR_HOMEPAGE, MAX_STREAMS_ON_HOMEPAGE);
- $res0 = $db->selectQuery($query)->array_data;
-}
-catch (SQLNoResultException $e)
-{
- $res0 = array();
-}
-
-// Standalone stuff
-// ORDER BY `listeners` DESC LIMIT %d --> this was removed, see above (except for
-// temporary, not triggered since everything exists in DB here)
try
{
- $query = 'SELECT CONCAT("s", `id`) AS `id`, "standalone" AS `type`, `stream_name`, `description`, `genre`, `listeners`, `url`, `current_song`, `media_type`, `bitrate`, `channels` FROM `mountpoints` WHERE `listeners` > %d AND `cluster_id` IS NULL;';
- $query = sprintf($query, MIN_LISTENERS_FOR_HOMEPAGE, MAX_STREAMS_ON_HOMEPAGE);
- $res1 = $db->selectQuery($query)->array_data;
-}
-catch (SQLNoResultException $e)
-{
- $res1 = array();
-}
-
-// Merging -- *not* done in DB, see above.
-function stream_compare($s0, $s1)
-{
- return ($s0['listeners'] > $s1['listeners']) ? -1 : (($s0['listeners'] == $s1['listeners']) ? 0 : +1);
-}
-$data = array_merge($res0, $res1);
-usort($data, 'stream_compare');
-
-// Add a "rank" item
-function set_rank(&$v, $k)
-{
- $v['rank'] = $k + 1;
-}
-array_walk($data, 'set_rank');*/
-
-try
-{
// $query = 'SELECT * FROM `mountpoint` ORDER BY `listeners` DESC LIMIT %d;';
$query = 'SELECT `id` FROM `mountpoint` ORDER BY RAND() LIMIT %d;';
$query = sprintf($query, MAX_STREAMS_ON_HOMEPAGE);
@@ -79,7 +36,7 @@
}
// array_slice($data, 0, MAX_STREAMS_ON_HOMEPAGE)
-$memcache->set(ENVIRONMENT.'_home_top', $data, false, 120) or die("Unable to save data on the Memcache server.\n");
+genfile::write(genfile::makeGenfileName('home_top'), $data) or die("Unable to save data in a genfile.\n");
echo("OK.\n");
?>
Modified: branches/dir.xiph.org/inc/inc.db.php
===================================================================
--- branches/dir.xiph.org/inc/inc.db.php 2008-04-10 15:29:14 UTC (rev 14692)
+++ branches/dir.xiph.org/inc/inc.db.php 2008-04-10 16:43:31 UTC (rev 14693)
@@ -20,7 +20,11 @@
}
else
{
- die("Unable to do this on test atm.\n");
+// die("Unable to do this on test atm.\n");
+ define('CP_DB_HOST', 'localhost');
+ define('CP_DB_USER', 'dir_xiph_org_t');
+ define('CP_DB_PASS', 'pSqvUfzxL5qXz.UH');
+ define('CP_DB_NAME', 'dir_xiph_org_test');
}
/**
Modified: branches/dir.xiph.org/inc/prepend.php
===================================================================
--- branches/dir.xiph.org/inc/prepend.php 2008-04-10 15:29:14 UTC (rev 14692)
+++ branches/dir.xiph.org/inc/prepend.php 2008-04-10 16:43:31 UTC (rev 14693)
@@ -18,7 +18,7 @@
}
else
{
- define('ENVIRONEMENT', 'test');
+ define('ENVIRONMENT', 'test');
}
//define('DEBUG', 'true');
@@ -50,6 +50,7 @@
include_once(dirname(__FILE__).'/inc.templating.php');
// Libs
+include_once(dirname(__FILE__).'/lib.genfile.php');
include_once(dirname(__FILE__).'/lib.uuidgen.php');
include_once(dirname(__FILE__).'/lib.dir.php');
include_once(dirname(__FILE__).'/lib.utils.php');
Modified: branches/dir.xiph.org/index.php
===================================================================
--- branches/dir.xiph.org/index.php 2008-04-10 15:29:14 UTC (rev 14692)
+++ branches/dir.xiph.org/index.php 2008-04-10 16:43:31 UTC (rev 14693)
@@ -9,7 +9,7 @@
$tpl->display("head.tpl");
// Get the data from the Memcache server
-$top = $memcache->get(ENVIRONMENT.'_home_top');
+$top = genfile::get(genfile::makeGenfileName('home_top'));
$top = array_map(array('Mountpoint', 'retrieveByPk'), $top);
$tpl->assign('data', $top);
$tpl->assign('servers_total', $memcache->get(ENVIRONMENT.'_servers_total'));
More information about the commits
mailing list