Jump to content
Sign in to follow this  
kuzvik

[Решено] Fatal error: Class 'OcModBase' not found in

Recommended Posts

Добрый ночи всем, подскажите пожалуйста как исправить трабл...не могу зайти в админку , выскакивает ошибка

 

Fatal error: Class 'OcModBase' not found in /home/v/vecros/verandoss/public_html/admin/model/module/ocj_doctor_mod_classes.php on line 127

 

Пытаюсь перенести сайт с локалки на хостинг...

Я так понимаю не находит класс модуля, ввиду того, что имя базы данных стало с префиксом ( так у хостера формируется имя БД), в следствии чего и не может найти определенный класс модуля... (Или я ошибаюсь и проблема в другом?)

файлы перезаписывал уже раз по 100 не помогает...

настройки config.php  и admin/config.php - проверяли вместе с хостером по несколько раз, все там в порядке.

 

Как объявить этот класс? куда что прописать?

Спасибо всем откликнувшимся..

* [OCJ] Doctor Mod
*
* @copyright 2015 OpenCartJazz
* @link http//www.opencartjazz.com
* @author Sergey Ogarkov
*
* @license GNU GPL v.3
*/

/**
* Core Mod
* The abstract class describes functions to
* -- detect VirtualMod installation,
* -- check is Mod active
* -- has it errors in the installation.
*/
abstract class CoreMod extends Model {
protected $installed = false;
protected $inuse = false;
protected $modules = array();
protected $errorr_log = array();
const MAX_LOG_SIZE = 2048000;

public function run() {
$this->checkInstall();
if($this->installed) {
$this->fetchModules();
}
if($this->inuse) {
$this->parseLog();
$this->updateFailedModules();
}
}
/**
* Checks is a tool installed
*/
abstract protected function checkInstall();
/**
* Fetch list of modules installed by a tool
*/
abstract protected function fetchModules();
/**
* Parse installation log
*/
abstract protected function parseLog();
/**
* Update list of modules by information about fails
* from the log
*/
abstract protected function updateFailedModules();
/**
* Returns the module name
*/
abstract public function getModName();
/**
* Returns the url of the module description
*/
abstract public function getUrl();
/**
* Is Mod installed
* @return boolean true-yes; false-no
*/
public function isInstalled() {
return $this->installed;
}

/**
* Is Mod used in the configuration?
* @return boolean true-yes; false-no
*/
public function isActive() {
return $this->inuse;
}

/**
* Has Mod errors in the installation log
* @return boolean true - has errors; false - fas no errors;
*/
public function hasErrors() {
return !empty($this->errorr_log);
}

/**
* Returns list of modules
* @return multitype:
*/
public function getModules() {
return $this->modules;
}

/**
* Returns error log
* @return multitype:
*/
public function getErrorLog() {
return $this->errorr_log;
}

public function toString() {
$str = get_class($this).':';
$str.= $this->installed ? ' installed;' : ' not installed;';
if($this->installed) {
$str.= $this->inuse ? ' in use;' : ' not in use;';
}
if($this->inuse) {
$str.= ' total: '.count($this->modules).'; failed: '.count($this->errorr_log);
}
return $str;
}

public function toJson() {
$json = array();
foreach($this as $key => $value) {
$json[$key] = $value;
}

return json_encode($json);
}
}

/**
* Classic vQmod
* @link https://github.com/vqmod/vqmod
*/
class ClassicVqMod extends OcModBase {
/**
* Returns the module name
*/
public function getModName() {
$this->load->language('module/ocj_doctor_mod');
return $this->language->get ( 'text_name_vqmod' );
}
/**
* Returns the url of the module description
*/
public function getUrl() {
return 'https://github.com/vqmod/vqmod';
}

/**
* Checks is vQmod installed. The following should present:
* -- uncommented string 'VQMod::bootup();' in the /index.php
* @see VirtualQuickMod::checkInstall()
*/
protected function checkInstall() {
$path = DIR_APPLICATION.'index.php';
$file_content=file_get_contents($path);
if($file_content===false) {
throw new IoException($path);
}
$vq_str = 'VQMod::bootup';

// Remove all occurrencies of multiline comments
$file_content = mb_eregi_replace('/\*.*?\*/','', $file_content);
// Remove single-line comments
$file_content = preg_replace('~//.*\R~i','', $file_content);
// Find vQmod installation string
$n_found = preg_match('~'.$vq_str.'~i', $file_content);
$this->installed = $n_found>0;
}

/**
* Checks is vQmod active.
* Confirmation - *.xml files in the /vqmod/xml/ directory
*
* @see VirtualQuickMod::fetchModules()
*/
protected function fetchModules() {
$path = DIR_APPLICATION . '../vqmod/xml/';
$files = glob ( $path . '*.xml' );
if ($files) {
foreach ( $files as $file ) {
$this->xmls [$file] = file_get_contents ( $file );
}
}
foreach ( $this->xmls as $file=>$xml ) {
$dom = new DOMDocument ( '1.0', 'UTF-8' );
$dom->preserveWhiteSpace = false;
$dom->loadXml ( $xml );

$this->modules [$this->getId ( $dom )] = array (
'modfile' => $file,
'name' => $this->getName ( $dom ),
'id' => $this->getId ( $dom ),
'author' => $this->getAuthor ( $dom )
);
}
unset ( $this->xmls );

$this->inuse = ! empty ( $this->modules );
}

protected function parseLog() {
$path = DIR_APPLICATION.'../vqmod/logs/';
$logs = glob($path.'*.log');
foreach($logs as $log) {
if(filesize($log) < self::MAX_LOG_SIZE*2) {
$content = file_get_contents($log);
if(!empty($content)) {
$n = preg_match_all('~\b(?:id|author|modFile)\b\s*:.*\R~i', $content, $matches);
for($i=1;$i<=$n/3;$i++) {
for($j=1;$j<=3; $j++) {
$line = array_shift($matches[0]);
$value=preg_replace('~.*:\s(.*)\n~i', '$1', $line);
preg_match('~\b(?:id|author|modFile)\b~i', $line, $keys);
if(strtolower($keys[0]) == 'id') {
$id = $value;
}
elseif(strtolower($keys[0]) == 'author') {
$author = $value;
}
elseif(strtolower($keys[0]) == 'modfile') {
$modfile = $value;
}
}
// Lod only errors for existed modules
if(isset($this->modules[$id])) {
$this->errorr_log[$id] = array(
'modfile'=>$modfile,
'id'=>$id,
'author'=>$author,
);
}
}
}
}
}
}

/**
* Update list of modules by the fail data from log
* @see CoreMod::updateFailedModules()
*/
protected function updateFailedModules() {
$idx = array();
foreach($this->modules as $key=>&$mod) {
$idx[$key]=$mod['name'];
$mod['failed'] = isset($this->errorr_log[$key]);
}
array_multisort($idx, SORT_ASC, SORT_STRING, $this->modules);
}
}

/**
* vQmod compatible with OCMod
* @link http://forum.opencart.com/viewtopic.php?t=119904
* @author sergey
*
*/
class VqModPlus extends OcModBase {
/**
* Returns the module name
*/
public function getModName() {
$this->load->language('module/ocj_doctor_mod');
return $this->language->get ( 'text_name_vqmod_plus' );
}
/**
* Returns the url of the module description
*/
public function getUrl() {
return 'http://www.opencart.com/index.php?route=extension/extension/info&extension_id=19501';
}

/**
* Specify suffixes for applied xml files that are loaded directly
* @return string
*/
protected function getSuffix() {
return 'vqmod';
}

protected function checkInstall() {
$path = DIR_APPLICATION.'controller/extension/modification.php';
$file_content=file_get_contents($path);
if($file_content===false) {
throw new IoException($path);
}
$vq_str = 'protected function vqmodWrite';

// Remove all occurrencies of multiline comments
// $file_content = preg_replace('~/\*(?:.|\n)*?\*/~i','', $file_content); // System crash
$file_content = mb_eregi_replace('/\*.*?\*/','', $file_content);
// Remove single-line comments
$file_content = preg_replace('~//.*\R~i','', $file_content);
// Find vQmod installation string
$n_found = preg_match('~'.$vq_str.'~i', $file_content);
$this->installed = $n_found>0;

}

protected function fetchModules() {
$this->loadXmlAll();

foreach ($this->xmls as $xml) {
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->preserveWhiteSpace = false;
$dom->loadXml($xml);

if ($this->isVqmod( $dom )) {
$this->inuse = true;
$this->modules[$this->getId($dom)] = array(
'name' => $this->getName($dom),
'id' => $this->getId($dom),
'author'=> $this->getAuthor($dom),
);
}
}
unset($this->xmls);
$this->inuse = !empty($this->modules);
}

protected function parseLog() {
$log_file = DIR_LOGS.'ocmod.log';
$file_size = @filesize($log_file);
if($file_size > self::MAX_LOG_SIZE) {
throw new FileSizeException($log_file,$file_size);
}
$log =@file_get_contents($log_file);
if($log===false) {
throw new NoLogException();
}
$n = preg_match_all("~(Modification::refresh.*(((?!Processing).)* :|((?!Done).)* :))|(modification\sid.*'.*')~i", $log, $mods);
for($i=1;$i<=$n/2;$i++) {
for($j=1;$j<=2; $j++) {
$line = array_shift($mods[0]);
if($j==1) {
$error = preg_replace('~^.+-\s+(.*):~i', '$1', $line);
}
else {
$id = preg_replace("~^.+'(.*)'~i", '$1', $line);
}
}
$this->errorr_log[$id] = array(
'name' => $this->modules[$id]['name'],
'id' => $id,
'author'=> $this->modules[$id]['author'],
'error' => $error,
);
}
}

/**
* Update list of modules by the fail data from log
* @see CoreMod::updateFailedModules()
*/
protected function updateFailedModules() {
$idx=array();
foreach($this->modules as $key=>&$mod) {
$idx[$key]=$mod['name'];
$mod['failed'] = isset($this->errorr_log[$key]);
$mod['error'] = isset($this->errorr_log[$key]) ? $this->errorr_log[$key]['error'] : null;
}
array_multisort($idx, SORT_ASC, SORT_STRING, $this->modules);
}
}

/**
* OCmod - native tool
* @author sergey
*
*/
class OcMod extends OcModBase {
/**
* Returns the module name
*/
public function getModName() {
$this->load->language('module/ocj_doctor_mod');
return $this->language->get ( 'text_name_ocmod' );
}
/**
* Returns the url of the module description
*/
public function getUrl() {
return 'https://github.com/opencart/opencart/wiki/Modification-System';
}

/**
* Specify suffixes for applied xml files that are loaded directly
* @return string
*/
protected function getSuffix() {
return 'ocmod';
}

/**
* Native tool is built-in.
* Always true
*/
protected function checkInstall() {
$this->installed = true;
}

protected function fetchModules() {
$this->loadXmlAll();

foreach ($this->xmls as $xml) {
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->preserveWhiteSpace = false;
$dom->loadXml($xml);

if (!$this->isVqmod( $dom )) {
$this->inuse = true;
$this->modules[$this->getName($dom)] = array(
'name' => $this->getName($dom),
'id' => $this->getId($dom),
'author'=> $this->getAuthor($dom),
);
}
}
unset($this->xmls);
$this->inuse = !empty($this->modules);
}

protected function parseLog() {
$log_file = DIR_LOGS.'ocmod.log';
$file_size = @filesize($log_file);
if($file_size > self::MAX_LOG_SIZE) {
throw new FileSizeException($log_file,$file_size);
}
$log =@file_get_contents($log_file);
if($log===false) {
throw new NoLogException();
}
$not_found_msg = 'NOT FOUND!';
$aborting_msg = 'ABORTING!';
$n = preg_match_all("~MOD:\s(.*\s)+?-{50,75}~i", $log, $mods);
for($i=1;$i<=$n;$i++) {
$block = array_shift($mods[0]);
$name = preg_replace('~MOD:\s(.*)\s(?:.*\s)*-{50,75}~i', '$1', $block);
$n_err = preg_match_all('~('.$not_found_msg.')|('.$aborting_msg.')~', $block,$matches);

if(isset($this->modules[$name])) {
// Add module with error
if($n_err) {
$this->errorr_log[$name] = array(
'name'=>$name,
'id'=>$this->modules[$name]['id'],
'author'=>$this->modules[$name]['author'],
'error'=>$matches[0],
);
}
// If newer refresh has no errors, remove old error from the log
else {
unset($this->errorr_log[$name]);
}
}
}
}

/**
* Update list of modules by the fail data from log
* @see CoreMod::updateFailedModules()
*/
protected function updateFailedModules() {
$idx=array();
foreach($this->modules as $key=>&$mod) {
$idx[$key]=$mod['name'];
$mod['failed'] = isset($this->errorr_log[$key]);
$mod['error'] = isset($this->errorr_log[$key]) ? implode('
',$this->errorr_log[$key]['error']) : null;
}
array_multisort($idx, SORT_ASC, SORT_STRING, $this->modules);
}
}
/**
* Base class for OCMOD and compatible VqMod
* @author sergey
*
*/
abstract class OcModBase extends CoreMod {

protected $xmls = array();

/**
* Specified suffixes for applied xml files that are loaded directly
* @return string
*/
protected function getSuffix() {
return 'ocmod,vqmod';
}

protected function isVqmod( DOMDocument $dom ) {
$modification_node = $dom->getElementsByTagName('modification')->item(0);
if ($modification_node) {
$vqmver_node = $modification_node->getElementsByTagName('vqmver')->item(0);
if ($vqmver_node) {
return true;
}
}
return false;
}

protected function getName( DOMDocument $dom ) {
$name=false;
$modification_node = $dom->getElementsByTagName('modification')->item(0);
if ($modification_node) {
$name_node = $modification_node->getElementsByTagName('name')->item(0);
if($name_node) {
$name = $name_node->nodeValue;
}
else {
$name=$this->getId($dom);
}
}
return $name;
}

protected function getId( DOMDocument $dom ) {
$id=false;
$modification_node = $dom->getElementsByTagName('modification')->item(0);
if ($modification_node) {
$id_node = $modification_node->getElementsByTagName('id')->item(0);
if($id_node) {
$id = $id_node->nodeValue;
}
else {
$id_node = $modification_node->getElementsByTagName('code')->item(0);
if($id_node) {
$id = $id_node->nodeValue;
}
}
}
return $id;
}

protected function getAuthor( DOMDocument $dom ) {
$author = false;
$modification_node = $dom->getElementsByTagName('modification')->item(0);
if ($modification_node) {
$author_node = $modification_node->getElementsByTagName('author')->item(0);
if($author_node) {
$author = $author_node->nodeValue;
}
}
return $author;
}


protected function loadXmlAll() {
// This is purly for developers so they can run mods directly and have them run without upload sfter each change.
$files = glob(DIR_SYSTEM.'*.{'.$this->getSuffix().'}.xml',GLOB_BRACE);

if ($files) {
foreach ($files as $file) {
$this->xmls[] = file_get_contents($file);
}
}

// Get the default modification file
$this->load->model('extension/modification');
$results = $this->model_extension_modification->getModifications();

foreach ($results as $result) {
if ($result['status']) {
$this->xmls[] = $result['xml'];
}
}
}
}

class IoException extends RuntimeException{}
class NoLogException extends RuntimeException{}
class FileSizeException extends RuntimeException{}

Edited by kuzvik

Share this post


Link to post
Share on other sites

спрашивать у автора модуля

Share this post


Link to post
Share on other sites

каким образом вообще можно этот модуль отключить и удалить из файлов сайта?

Share this post


Link to post
Share on other sites

Проблему решил, тему можно закрывать..

 

Если у кого что то похожее то ищите вызов модулей в фале................../system/modification/admin/controller/extension/modification.php. закоментировав 2 строки все стало работать) у меня движок opencart 2.0.0.1.

Share this post


Link to post
Share on other sites

В таких случаях надо не временный кеш менять руками, а удалять его. Потом в админке выключать проблемный модуль (или все), чистить лог ocmod.log и обновляя модификации, искать причины конфликтов.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.