hary
Может можно сюда показать, может то в корне у меня неправильно там
Дмитрий
Eugene
hary
hary
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
//error_log("Старт скрипта", 3, 'logfile.log');
error_log("Query string: " . $_SERVER['QUERY_STRING'], 3, 'logfile.log');
// Подключение к Joomla
// We are a valid entry point.
define('_JEXEC', 1);
// Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
define('JOOMLA_MINIMUM_PHP', '7.2.5');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) {
echo 'Sorry, your PHP version is not supported.' . PHP_EOL;
echo 'Your command line PHP needs to be version ' . JOOMLA_MINIMUM_PHP . ' or newer to run the Joomla! CLI Tools' . PHP_EOL;
echo 'The version of PHP currently running this code, at the command line, is PHP version ' . PHP_VERSION . '.' . PHP_EOL;
echo 'Please note, the version of PHP running your commands here, may be different to the version that is used by ';
echo 'your web server to run the Joomla! Web Application' . PHP_EOL;
exit;
}
// Load system defines
if (file_exists(dirname(DIR) . '/defines.php')) {
require_once dirname(DIR) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(DIR));
require_once JPATH_BASE . '/includes/defines.php';
}
// Get the framework.
require_once JPATH_BASE . '/includes/framework.php';
// Boot the DI container
$container = \Joomla\CMS\Factory::getContainer();
/*
* Alias the session service keys to the CLI session service as that is the primary session backend for this application
* In addition to aliasing "common" service keys, we also create aliases for the PHP classes to ensure autowiring objects
* is supported. This includes aliases for aliased class names, and the keys for aliased class names should be considered
* deprecated to be removed when the class name alias is removed as well.
*/
$container->alias('session', 'session.cli')
->alias('JSession', 'session.cli')
->alias(\Joomla\CMS\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\SessionInterface::class, 'session.cli');
$app = \Joomla\CMS\Factory::getContainer()->get(\Joomla\Console\Application::class);
\Joomla\CMS\Factory::$application = $app;
$app->execute();
// Загрузка моделей и библиотек
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_content/models', 'ContentModel');
// Получение списка статей
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
$articles = $model->getItems();
foreach ($articles as $article) {
// Проверка, заполнено ли поле вступительного изображения
$images = json_decode($article->images, true);
if (empty($images['image_intro'])) {
// Извлечение адреса первой фотографии из содержимого статьи
if (preg_match('/<img.*?src=["\'](.*?)["\']/', $article->introtext, $matches)) {
$imageUrl = $matches[1];
// Запись адреса в поле вступительного изображения
$images['image_intro'] = $imageUrl;
$article->images = json_encode($images);
// Сохранение статьи
$articleTable = JTable::getInstance('content');
$articleTable->load($article->id);
$articleTable->images = $article->images;
$articleTable->store();
echo "Обновлена статья ID {$article->id} с изображением {$imageUrl}\n";
}
} else {
echo "Статья ID {$article->id} уже имеет вступительное изображение\n";
}
}
echo "Готово!\n"; [/code]
Vladimir
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
//error_log("Старт скрипта", 3, 'logfile.log');
error_log("Query string: " . $_SERVER['QUERY_STRING'], 3, 'logfile.log');
// Подключение к Joomla
// We are a valid entry point.
define('_JEXEC', 1);
// Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
define('JOOMLA_MINIMUM_PHP', '7.2.5');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) {
echo 'Sorry, your PHP version is not supported.' . PHP_EOL;
echo 'Your command line PHP needs to be version ' . JOOMLA_MINIMUM_PHP . ' or newer to run the Joomla! CLI Tools' . PHP_EOL;
echo 'The version of PHP currently running this code, at the command line, is PHP version ' . PHP_VERSION . '.' . PHP_EOL;
echo 'Please note, the version of PHP running your commands here, may be different to the version that is used by ';
echo 'your web server to run the Joomla! Web Application' . PHP_EOL;
exit;
}
// Load system defines
if (file_exists(dirname(DIR) . '/defines.php')) {
require_once dirname(DIR) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(DIR));
require_once JPATH_BASE . '/includes/defines.php';
}
// Get the framework.
require_once JPATH_BASE . '/includes/framework.php';
// Boot the DI container
$container = \Joomla\CMS\Factory::getContainer();
/*
* Alias the session service keys to the CLI session service as that is the primary session backend for this application
* In addition to aliasing "common" service keys, we also create aliases for the PHP classes to ensure autowiring objects
* is supported. This includes aliases for aliased class names, and the keys for aliased class names should be considered
* deprecated to be removed when the class name alias is removed as well.
*/
$container->alias('session', 'session.cli')
->alias('JSession', 'session.cli')
->alias(\Joomla\CMS\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\SessionInterface::class, 'session.cli');
$app = \Joomla\CMS\Factory::getContainer()->get(\Joomla\Console\Application::class);
\Joomla\CMS\Factory::$application = $app;
$app->execute();
// Загрузка моделей и библиотек
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_content/models', 'ContentModel');
// Получение списка статей
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
$articles = $model->getItems();
foreach ($articles as $article) {
// Проверка, заполнено ли поле вступительного изображения
$images = json_decode($article->images, true);
if (empty($images['image_intro'])) {
// Извлечение адреса первой фотографии из содержимого статьи
if (preg_match('/<img.*?src=["\'](.*?)["\']/', $article->introtext, $matches)) {
$imageUrl = $matches[1];
// Запись адреса в поле вступительного изображения
$images['image_intro'] = $imageUrl;
$article->images = json_encode($images);
// Сохранение статьи
$articleTable = JTable::getInstance('content');
$articleTable->load($article->id);
$articleTable->images = $article->images;
$articleTable->store();
echo "Обновлена статья ID {$article->id} с изображением {$imageUrl}\n";
}
} else {
echo "Статья ID {$article->id} уже имеет вступительное изображение\n";
}
}
echo "Готово!\n"; [/code]
Бесплатная версия ?
hary
ну тут да
hary
и копилот был. шото он поназабывал. я смотрел как в оригинальном джумловском, и верх забрал оттуда. но ничего не происходит. говорит, забей там логфайл чтобы писало. писать то он пишет, а толку - до дела не доходит
hary
я ж не хочу пару наверное тыщ статей перелопачивать
hary
я правильно понимаю что в моем варианте так не пойдет, надо написать плагин, и все это от плагина работает, так?
Vladimir
hary
и оригинальный файл джумлы сам в себе ничего ж не имеет, он все эти команды по плагинам подбирает, так?
Vladimir
Vladimir
hary
ну тоткоторый уже лежіт в папке КЛІ
Vladimir
https://habr.com/ru/articles/696222/
Sergey
Alexey
А, да, релиз так и не сделал этого плагина, можно просто мастер ветку поставить
mod_fcgid: stderr: PHP Fatal error: Declaration of Mpdf\\Mpdf::setLogger(Psr\\Log\\LoggerInterface $logger) must be compatible with Psr\\Log\\LoggerAwareInterface::setLogger(Psr\\Log\\LoggerInterface $logger): void in /var/www/vhosts/………./libraries/mpdf/libraries/vendor/mpdf/psr-log-aware-trait/src/MpdfPsrLogAwareTrait.php on line 15
Alexey
Почему-то ошибка. Брал из мастер
Vladimir
Artem
Походу mpdf обновился
Дмитрий
@sergeytolkachyov ты же аадптировал компонент логера? можелшь скинуть репу?
Дмитрий
нашел
Alexey
Дмитрий
либу скачай из релизов
Sergey
Владимир
https://dzen.ru/a/ZwpOQ8oIlSjY5VRf
AES все
RINAT
Расширение joomla для интернет магазина J2Store закрывается
https://www.j2store.org/
Artem
Alexey
либу скачай из релизов
Поставил jmpdf_8.0.11.zip, JPDF Generator выдает такую ошибку Class "Joomla\Libraries\JMpdf\JMpdf" not found0/var/www/vhosts/…../plugins/system/jpdfgenerator/src/Extension/JPDFGenerator.php101Array
Alexey
Php 8.2.24
Alexey
В логах ошибка mod_fcgid: stderr: PHP Warning: Array to string conversion in /var/www/vhosts/……/components/com_ajax/ajax.php on line 230
Alexey
Тестирую https://………/index.php?option=com_ajax&plugin=jpdfgenerator&group=system&format=raw&template=mycards&action=download&ids=2556
Дмитрий
Alexey
Alexey
да
Дмитрий
Георгий
а файлы сделал? внутри
Дмитрий, приветствую. Это мы с Алексеем бъемся с JPDFGeneratorom. Да файлы внутри сделаны.
Дмитрий
Дмитрий
в самом плагине
Дмитрий
не совсем догоняю что ему не так
Георгий
В файле /plugins/system/jpdfgenerator/src/Extension/JPDFGenerator.php не находит класс Joomla\Libraries\JMpdf\JMpdf
Дмитрий
а либу поставили?
Дмитрий
https://github.com/Delo-Design/jmpdf/releases/tag/build.1706103807
Дмитрий
вот
Георгий
Да /jmpdf_8.0.11.zipа
Георгий
В ней как раз этот клас и прописывается
Георгий
Георгий
В 8.2.2 ругается на PSRLog
Дмитрий
[v
Дмитрий
хм
Дмитрий
это старая
Дмитрий
вы эту поставьте что я скинул
Дмитрий
версия старая
Дмитрий
я переделал там нейсмейсы сделал
Дмитрий
https://github.com/Delo-Design/jmpdf/blob/master/src/JMpdf.php
Дмитрий
в последних переместил на namespace и сделал для j4 и выше уже
Дмитрий
8.2.2 не работает?
Дмитрий
@gasilins поставили?
Георгий
Поставил Как и раньше выдает 500 ошибку
Георгий
В логах mod_fcgid: stderr: PHP Fatal error: Declaration of Mpdf\\Mpdf::setLogger(Psr\\Log\\LoggerInterface $logger) must be compatible with Psr\\Log\\LoggerAwareInterface::setLogger(Psr\\Log\\LoggerInterface $logger): void in /var/www/vhostslibraries/mpdf/libraries/vendor/mpdf/psr-log-aware-trait/src/MpdfPsrLogAwareTrait.php on line 15
Дмитрий
а джумла какая?
Георгий
5.1.4
Дмитрий
я просто тестировал только на 4.x джумле
Дмитрий
может быть дужмла логгер загрузила в 5.x и просто конфликт из-за этого
Дмитрий
я просто не проверял именно это
Георгий
Да с mpdf 8.2.2 так и есть
Георгий
Я поэтому и поставил 8.0.11
Георгий
Но почему клас Jmpdf не находится не понимаю
Дмитрий
щас
Dmitriy
Дмитрий
ну надо смотреть, я просто регион свой еще не поднял на 5.x
Дмитрий
поэтому не заметил
Дмитрий
@gasilins
https://github.com/Delo-Design/jpdfgenerator/releases/tag/1.0
Георгий
А какая версия jpdfgeneratora под 8.0.11?