fastslack/jUpgradePro

afterAllStepsHook() never runs in plugins

klas opened this issue · 1 comments

klas commented
        // Select last step
    $query->select('name');
    $query->from($this->_table);
    //$query->where("(status = 0 OR status = 1)");
    $query->where("(status = 0)");
    if ($this->_table == '#__jupgradepro_extensions_tables') {
        $query->where("element = '{$step['element']}'");
    }
    $query->where("version = {$this->_db->quote($this->old_ver)}");
    $query->order('id DESC');
    $query->limit(1);
    $testquery = (string)$query;
    $this->_db->setQuery($query);
    $step['laststep'] = $this->_db->loadResult();

Will not return any result when we are in the actual last step, last steps $step['laststep'] is empty as tables status in jupgradepro_extensions_tables is changed to 1 before this point.

This causes the bellow code from JUpgradepro::setDestinationData to never evaluate to true

// Call after all steps hook
if ($this->_step->name == $this->_step->laststep && $this->_step->cache == 0 && $this->getTotal() == $this->_step->cid) {
    $this->ready = $this->afterAllStepsHook();
}

If a change query where above to get true laststep to $query->where("(status = 0 OR status = 1)"); this breaks plugins execution - only first plugin is executed as code somewhere thinks this is the last of all plugin steps...

Needs to be fixed by you, I was going in circles here... perhaps just $this->_step->name == $this->_step->laststep should be changed to $this->_step->laststep == '' in if clause - or query should be changed as sugegsted and mutiple plugins executin resolved in some other way e.g. by javascript changes.