Using goto to wait on the result of a database query to change
Besides the unjustified use of goto, I also object to the use of the number 4 for an operation that you try up to 6 times.

Counting loops are usually best written as for loops.

public function wait_lock() {
    for ($tries = 0; $tries &lt; 6 &amp;&amp; !($lock = $this-&gt;is_enabled('cache-lock')); ++$tries) {
        sleep(1);
    }
    if (!$lock) {
        // the following method is a short cut for throwing an exception.
        $this-&gt;e('cache error. wait a few moments and try again. if the problem persists, contact the administrator.');
    }
}