Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/app_controller.php
diff options
context:
space:
mode:
authormorgamic@mozilla.com <morgamic@mozilla.com@4eb1ac78-321c-0410-a911-ec516a8615a5>2008-02-14 04:16:06 (GMT)
committer morgamic@mozilla.com <morgamic@mozilla.com@4eb1ac78-321c-0410-a911-ec516a8615a5>2008-02-14 04:16:06 (GMT)
commitd4173ee8c5146cee9b9b9d3ddec52d41660139a0 (patch)
tree9b86f90d4c6d33e93ebf75cfdd00dea7bf03808b /site/app/app_controller.php
parent831eadcf1b8650835a71e148c14d36ef3b92b9ec (diff)
Checking in shadow db fixes from bug 417395 to help alleviate API load. Still pending AMO review, but pushing to API vhost.
git-svn-id: http://svn.mozilla.org/addons/trunk@10322 4eb1ac78-321c-0410-a911-ec516a8615a5
Diffstat (limited to 'site/app/app_controller.php')
-rw-r--r--site/app/app_controller.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/site/app/app_controller.php b/site/app/app_controller.php
index 76c14a7..0f4a120 100644
--- a/site/app/app_controller.php
+++ b/site/app/app_controller.php
@@ -320,5 +320,30 @@ class AppController extends Controller
break;
}
}
+
+ /**
+ * Forces use of the shadowDb.
+ */
+ function forceShadowDb() {
+ foreach ($this->uses as $model) {
+ $this->{$model}->useDbConfig = 'shadow';
+ $this->setToShadow($this->{$model});
+ }
+ }
+
+ /**
+ * Sets a passed model to recursively use the shadow db.
+ */
+ function setToShadow(&$m) {
+ $m->useDbConfig = 'shadow';
+ if (is_array($m->__associations) and !empty($m->__associations)) {
+ foreach ($m->__associations as $association) {
+ foreach ($m->{$association} as $boundModel) {
+ $_n = $boundModel['className'];
+ $m->$_n->useDbConfig = 'shadow';
+ }
+ }
+ }
+ }
}
?>