PDOException: SQLSTATE[00000] [1040] Too many connections in spiralCore/components/dbal.php at line 107
spiralCore/components/dbal.php
97        {
98            $pdoDSN = $config['dbDriver'] . ':dbname=' . $config['dbName'];
99
100            if ($config['dbServer'])
101            {
102                //Server
103                $pdoDSN .= ';host=' . $config['dbServer'];
104            }
105
106            //Connection
107            self::$pdo = new PDO($pdoDSN, $config['dbUser'], $config['dbPassword'], $config['pdoOptions']);
108        }
109        catch (pdoException $pdoException)
110        {
111            self::$benchmarks['connection'] = microtime(true) - self::$benchmarks['connection'];
112            throw $pdoException;
113        }
114
115        self::$benchmarks['connection'] = microtime(true) - self::$benchmarks['connection'];
116        return self::$pdo;
117    }
spiralCore/components/orm/selector.php
463     * Fetch one object.
464     *
465     * @return ormObject
466     */
467    public function fetchOne()
468    {
469        //Only one line
470        $this->limit = 1;
471
472        //Object data (if childrens attached, result should be backed as numeric rowSet)
473        $objectsData = dbal::query($this->buildStatement(), dbal::select)->fetchRow(!$this->forceChildrens);
474
475        if (!$objectsData)
476        {
477            return self::createObject($this->table, array());
478        }
479
480        //Creation
481        if (!$this->forceChildrens)
482        {
483            //Fast selection
spiralCore/components/orm/selector.php
441    public function fetchByPrimary($primaryID, $toCache = true)
442    {
443        $primaryID = $primaryID + 0;
444
445        if (isset(self::$cached[$this->table . $primaryID]))
446        {
447            //Already selector (used for parents, or direct loading objects)
448            return self::$cached[$this->table . $primaryID];
449        }
450
451        $ormObject = $this->where($this->table . '.' . $this->schema['primary'], '=', $primaryID)->fetchOne();
452
453        if ($toCache)
454        {
455            //Save for future usage
456            self::$cached[$this->table . $primaryID] = $ormObject;
457        }
458
459        return $ormObject;
460    }
461
spiralCore/components/orm/selector.php
716
717        //Object selector
718        $objectSelector = new ormSelector($table);
719
720        if ($forceChildrens)
721        {
722            //Attach children(s)
723            $objectSelector->forceChildrens($forceChildrens);
724        }
725
726        return $objectSelector->fetchByPrimary($primaryID);
727    }
728
729    /**
730     * Save object to cache, to force selection in future.
731     *
732     * @static
733     * @param ormObject $instance
734     */
735    static public function toCache(ormObject $instance)
736    {
spiralCore/components/orm.php
119     */
120    static public function __callStatic($name, array $arguments)
121    {
122        if (array_key_exists($name, self::$schema))
123        {
124            return new ormSelector($name);
125        }
126
127        if (array_key_exists($name, self::$schema['@names']))
128        {
129            return ormSelector::fetchObject(self::$schema['@names'][$name], isset($arguments[0]) ? $arguments[0] : false, isset($arguments[1]) ? $arguments[1] : array());
130        }
131
132        throw new ormException("No selector or object found for '$name'.");
133    }
134}
spiralApplication/actions/lightbox.php
15{
16    static public $zoom = array(120, 130, 150, 180, 200, 250);
17
18    /**
19     * Displaying lightbox.
20     *
21     * @param int $lightboxID
22     */
23    public function display($lightboxID = false, $hash = '')
24    {
25        $lightbox = orm::lightboxObject($lightboxID);
26        if (!$lightbox->isLoaded())
27        {
28            self::callError('notFound');
29        }
30
31        if (!$lightbox->featured && $hash != md5($lightbox->id . '-' . $lightbox->memberID . '-happy-happy-salt-always-helps-me'))
32        {
33            self::callError('notFound');
34        }
35
spiralApplication/actions/lightbox.php
15{
16    static public $zoom = array(120, 130, 150, 180, 200, 250);
17
18    /**
19     * Displaying lightbox.
20     *
21     * @param int $lightboxID
22     */
23    public function display($lightboxID = false, $hash = '')
24    {
25        $lightbox = orm::lightboxObject($lightboxID);
26        if (!$lightbox->isLoaded())
27        {
28            self::callError('notFound');
29        }
30
31        if (!$lightbox->featured && $hash != md5($lightbox->id . '-' . $lightbox->memberID . '-happy-happy-salt-always-helps-me'))
32        {
33            self::callError('notFound');
34        }
35
3܃