title: How do I execute model-related code only once in CakePhp 2.3
body: <p><strong>What I want:</strong><br>
  I have a model <code>Version</code> with a member function <code>update</code>. I want this member function called once, every time a page is loaded.</p>
  
  <p><strong>What I did so far:</strong><br>
  My current approach is to add the line </p>
  
  <pre><code>ClassRegistry::init('Version')-&gt;update();
  </code></pre>
  
  <p>into the <code>beforeFilter()</code> method of <code>AppController</code></p>
  
  <p>A previous solution was, to put the following code into <code>app/Config/bootstrap.php</code>:</p>
  
  <pre><code>App::uses('CakeEventManager', 'Event');
  CakeEventManager::instance()-&gt;attach(
      function(){
          AppModel::getSingletonModel('Version')-&gt;update();
      },
      'Controller.startup'
  );
  </code></pre>
  
  <p>(<code>getSingletonModel</code> does what it sounds like - get a singleton instance of the model)</p>
  
  <p><strong>The Problem:</strong><br>
  Both solutions work, <em>but</em> if several controllers are loaded, the function is called several times. Which eats up resources.<br>
  Also, <code>ClassRegistry</code> has not been loaded, when <code>bootstrap.php</code> is executed. So I can't directly call the function there.</p>
  
  <p><strong>Additional Information:</strong><br>
  The (technical) reason for several Controllers being called seems to be, that in a dashboard view some content is generated by calling <code>$this-&gt;requestAction</code>. </p>
  
  <p><strong>My Question:</strong><br>
  Is there a way in CakePHP to call the function only once, like the file <code>app/Config/bootstrap.php</code>, but <em>after</em> the models are loaded?</p>
  
  <p><strong>Some Background:</strong>
  I'm developing a project in CakePHP 2.3 together with other developers.<br>
  I'm working on an autoupdate-system, where developers can add some code, which they want to run once (e.g. to adapt the database for added functionality).</p>