_______________________________________________________________
435817
function check(pathspec,pid_pref) {

	var result = false;

	filename = pathspec.split('\\');
	filename = filename[filename.length-1];
	if (filename.indexOf(pid_pref)>=0) {

		result = true;

		name = filename.split(pid_pref);
		desc = name[0].split('_-_');
		series = desc[0];
		episode = desc[1];
		if ((episode) && (episode.charAt(episode.length-1)=='_')) {
			episode = episode.slice(0,episode.length-1);
		}
		if (!episode) {
			episode = series;
		}

		name = name[1].split('.');
		pid = name[0].split('_')[0];
		pid = pid_pref+pid;

		if (giUtils.binarySearch(download_history,pid)<0) {

			suffix = name[1];
			if ((suffix=='mp4') || (suffix=='mov')) {
				type = 'tv';
			}
			else {
				type = 'radio';
			}

			stat = fs.statSync(pathspec);
			var time = Math.floor(stat.mtime.getTime()/1000);

			entry = pid+'|'+series+'|'+episode+'|'+type+'|'+time+
			  '|hlsaacstd1|'+pathspec+'|default,original|1800||||||||||';
			console.log(pid+'|'+series+'|'+episode+'|'+type+'|'+time);
			download_history.push(pid); //tail end is no longer sorted

			entries.push(entry);

		}
		else {
			//console.log('Already in history '+pid+' '+pathspec+' at index '+download_history.indexOf(pid));
		}
	}
	return result;
}
1026506
public function init() {

		parent::init();

		// Permission
		$this->crudPermission = CoreGlobal::PERM_USER;

		// Config
		$this->baseUrl	= '/user';
		$this->apixBase	= 'core/user';

		// Services
		$this->modelService = Yii::$app->factory->get( 'userService' );

		$this->optionService = Yii::$app->factory->get( 'optionService' );

		$this->countryService		= Yii::$app->factory->get( 'countryService' );
		$this->provinceService		= Yii::$app->factory->get( 'provinceService' );
		$this->regionService		= Yii::$app->factory->get( 'regionService' );
		$this->addressService		= Yii::$app->factory->get( 'addressService' );
		$this->modelAddressService	= Yii::$app->factory->get( 'modelAddressService' );
	}
1318979
public function build()
    {
        $issue = $this->root;
        $this->issues[$issue->getKey()] = $issue;

        $unreceivedIssues = array_diff_key($this->issues, $this->populatedIssueKeys);
        while (count($unreceivedIssues) > 0 && $this->depth < $this->maxDepth) {
            $unpopulatedIssueKeys = [];
            foreach ($unreceivedIssues as $issue) {
                /** @var Issue $issue */
                $this->populatedIssueKeys[$issue->getKey()] = 1;

                foreach ($issue->getLinks() as $issueLink) {
                    $unpopulatedIssueKey = IssueLinkHelper::getLinkedIssueKey($issueLink);
                    if ($unpopulatedIssueKey) {
                        $unpopulatedIssueKeys[$unpopulatedIssueKey] = $unpopulatedIssueKey;
                    }
                }
            }

            $notProcessedIssueKeys = [];
            foreach ($unpopulatedIssueKeys as $issueKey) {
                if (!array_key_exists($issueKey, $this->issues)) {
                    $notProcessedIssueKeys[] = $issueKey;
                }
            }

            if ($notProcessedIssueKeys) {
                $issues = $this->getIssuesFromRepositoryByKeys($notProcessedIssueKeys);
                foreach ($issues as $issue) {
                    if (!array_key_exists($issue->getKey(), $this->issues)) {
                        $this->issues[$issue->getKey()] = $issue;
                    }
                }
            }

            $unreceivedIssues = array_diff_key($this->issues, $this->populatedIssueKeys);
            $this->depth++;
        }
    }
132156
public function initialize()
    {
        if ($this->initialized === false) {
            $this->data = $this->cursor->toArray();
        }
        $this->initialized = true;
    }
810772
public function initialize()
    {
        if ($this->initialized || ! $this->association) {
            return;
        }

        $this->doInitialize();

        $this->initialized = true;
    }
647781
public function init()
    {
        $valid = null;

        if ($this->cache->has(self::CACHE_KEY)) {
            $cached = $this->cache->get(self::CACHE_KEY);
            $valid  = $cached && isset($cached['hosts']) && count($cached['hosts']);
        }


        if ($valid) {
            $this->map = $cached;
        } else {
            $this->build();
        }
    }
401588
public function Bind()
	{
		if ( ! is_null( $this->_childs ) )
		{
			foreach ( $this->_childs as $node)
			{
				$node->Bind();
			}
		}
	}
1009299
public function join($element)
	{
		if($element->slave!==null)
			$this->join($element->slave);
		if(!empty($element->relation->select))
			$this->selects[]=$element->getColumnSelect($element->relation->select);
		$this->conditions[]=$element->relation->condition;
		$this->orders[]=$element->relation->order;
		$this->joins[]=$element->getJoinCondition();
		$this->joins[]=$element->relation->join;
		$this->groups[]=$element->relation->group;
		$this->havings[]=$element->relation->having;

		if(is_array($element->relation->params))
		{
			if(is_array($this->params))
				$this->params=array_merge($this->params,$element->relation->params);
			else
				$this->params=$element->relation->params;
		}
		$this->elements[$element->id]=true;
	}
670801
public function init()
    {
        parent::init();

        foreach ($this->columns as $column) {
            $column->init();
            // index the column by id if it is not already indexed
            if (!array_key_exists($column->id, $this->columns_by_id)) {
                $this->columns_by_id[$column->id] = $column;
            }
        }

        foreach ($this->extra_rows as $row) {
            $row->init();
            // index the row by id if it is not already indexed
            if (!array_key_exists($row->id, $this->rows_by_id)) {
                $this->rows_by_id[$row->id] = $row;
            }
        }

        foreach ($this->groups as $group) {
            $group->init();
            // index the group by id if it is not already indexed
            if (!array_key_exists($group->id, $this->groups_by_id)) {
                $this->groups_by_id[$group->id] = $group;
            }
        }

        foreach ($this->spanning_columns as $column) {
            $column->init();
            // index the row column by id if it is not already indexed
            if (!array_key_exists($column->id, $this->spanning_columns_by_id)) {
                $this->spanning_columns_by_id[$column->id] = $column;
            }
        }
    }
836456
public function init()
    {
        parent::init();
        if (!isset($this->translations['yii']) && !isset($this->translations['yii*'])) {
            $this->translations['yii'] = [
                '__class' => PhpMessageSource::class,
                'sourceLanguage' => 'en-US',
                'basePath' => '@yii/messages',
            ];
        }

        if (!isset($this->translations['app']) && !isset($this->translations['app*'])) {
            $this->translations['app'] = [
                '__class' => PhpMessageSource::class,
                'sourceLanguage' => $this->app->sourceLanguage,
                'basePath' => '@app/messages',
            ];
        }
    }
159786
public function commit() : void
    {
        if (null === $this->is_valid) {
            $this->validate();
        }
        if ($this->is_valid && $this->user_value != null) {
            $this->default_value = $this->user_value;
        }
        $this->user_value = null;
        $this->is_valid = null;
        $this->is_changed = false;
    }
587377
public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getModel();
        $details = ArrayObject::ensureArrayObject($payment->getDetails());

        try {
            $request->setModel($details);

            $this->gateway->execute($request);
        } finally {
            $payment->setDetails((array) $details);
        }
    }
810577
public function execute()
    {
        $this->addFromDeleteRels();

        $this->getModelsToDelete()->byRepo(function (Repo $repo, Models $models) {
            $repo->deleteModels($models);
        });

        $this->addFromInsertRels();

        $this->getModelsToInsert()->assertValid()->byRepo(function (Repo $repo, Models $models) {
            $repo->insertModels($models);
        });

        $this->addFromUpdateRels();

        $this->getModelsToUpdate()->assertValid()->byRepo(function (Repo $repo, Models $models) {
            $repo->updateModels($models);
        });
    }
1240372
public function execute()
    {
        if ($this->email && $this->locale) {
            $this->create();
        } elseif ($this->referenceId) {
            $this->delete();
        }
    }
432798
public function init()
    {
        if ($this->autoStart && !$this->isStarted()) {
            $this->start();

            $this->autoStart = false;
        }
    }
1178516
public function next(): void
    {
        $innerIterator = $this->getInnerIterator();
        $this->valid = $innerIterator->valid();

        if ($this->valid === false) {
            return;
        }

        $this->key = $innerIterator->key();
        $this->current = $innerIterator->current();

        $innerIterator->next();
    }
1043002
public function save()
    {
        $data = $this->getData();
        if (!$this->currentId)
        {
            $config = $this->config();
            $config->last_id++;

            $this->setField('id', $config->last_id);
            array_push($data, $this->set);

            Helpers\Config::table($this->name)->put($config);
        }
        else
        {
            $this->setField('id', $this->currentId);
            $data[$this->currentKey] = $this->set;
        }

        Helpers\Data::table($this->name)->put($data);

//         $this->setFields();
    }