GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Midgard Components Framework 3rd generation
Homepage: http://www.midgard-project.org
Clone URL: git://github.com/bergie/midcom.git
Deal with memcached being down
bergie (author)
Thu Sep 04 01:54:47 -0700 2008
commit  46bc93ce3314a0730254afb3fa0c65ec8d9586d0
tree    891e6a8dd9fb753f8ef92c4250bfaff3bf4d712c
parent  48c983e2545d751b3c619ee9b83dfd2ea77588e7
...
204
205
206
207
 
208
209
 
 
 
210
211
212
213
 
214
215
216
217
218
 
219
 
 
 
 
 
 
 
 
220
221
222
223
224
225
 
 
 
 
 
 
 
 
226
227
228
...
204
205
206
 
207
208
 
209
210
211
212
 
 
 
213
214
 
 
 
 
215
216
217
218
219
220
221
222
223
224
225
226
227
228
 
 
229
230
231
232
233
234
235
236
237
238
239
0
@@ -204,25 +204,36 @@ class midcom_core_component_loader
0
         }
0
     }
0
 
0
- private function load_all_manifests()
0
+ private function load_all_manifests_uncached()
0
     {
0
- if (!class_exists('Memcache'))
0
+ // Uncached manifest loading is very slow
0
+ exec('find ' . escapeshellarg(MIDCOM_ROOT) . ' -follow -type f -name ' . escapeshellarg('manifest.yml'), $manifests);
0
+ foreach ($manifests as $manifest)
0
         {
0
- // Uncached manifest loading is very slow
0
- exec('find ' . escapeshellarg(MIDCOM_ROOT) . ' -follow -type f -name ' . escapeshellarg('manifest.yml'), $manifests);
0
- foreach ($manifests as $manifest)
0
+ if (strpos($manifest, 'scaffold') === false)
0
             {
0
- if (strpos($manifest, 'scaffold') === false)
0
- {
0
- $this->load_manifest($manifest);
0
- }
0
+ $this->load_manifest($manifest);
0
             }
0
+ }
0
+ }
0
+
0
+ private function load_all_manifests()
0
+ {
0
+ if (!class_exists('Memcache'))
0
+ {
0
+ $this->load_all_manifests_uncached();
0
             return;
0
         }
0
 
0
         // TODO: Refactor to utilize cache service infrastructure
0
- $memcache = new Memcache;
0
- $memcache->connect('localhost');
0
+ $memcache = new Memcache();
0
+ if (!@$memcache->connect('localhost'))
0
+ {
0
+ // Couldn't connect
0
+ $this->load_all_manifests_uncached();
0
+ return;
0
+ }
0
+
0
         if (!$manifests = $memcache->get('manifests'))
0
         {
0
             exec('find ' . escapeshellarg(MIDCOM_ROOT) . ' -follow -type f -name ' . escapeshellarg('manifest.yml'), $manifests);

Comments

    No one has commented yet.