Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace-, Klassen- und Dateinamen anpassen #86

Merged
merged 3 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
use rex_addon;
use rex_api_function;
use rex_cronjob_manager;
use rex_cronjob_neues_publish;
use rex_cronjob_neues_sync;
use rex_csrf_token;
use rex_extension;
use rex_plugin;
use rex_url;
use rex_yform_manager_dataset;

if (rex_addon::get('cronjob')->isAvailable() && !rex::isSafeMode()) {
rex_cronjob_manager::registerType(rex_cronjob_neues_publish::class);
rex_cronjob_manager::registerType(rex_cronjob_neues_sync::class);
rex_cronjob_manager::registerType(Cronjob\Publish::class);
rex_cronjob_manager::registerType(Cronjob\Sync::class);
}

if (rex_addon::get('yform')->isAvailable() && !rex::isSafeMode()) {
Expand All @@ -38,10 +36,10 @@
);
}

rex_api_function::register('neues_rss', neues_rss_api::class);
rex_api_function::register('neues_rss', Api\Rss::class);

if (rex_plugin::get('yform', 'rest')->isAvailable() && !rex::isSafeMode()) {
RestfulApi::init();
Api\Restful::init();
}

rex_extension::register('YFORM_DATA_LIST', Entry::epYformDataList(...));
Expand Down
22 changes: 20 additions & 2 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,26 @@

/* Cronjob installieren */
if (rex_addon::get('cronjob') && rex_addon::get('cronjob')->isAvailable()) {
$cronjob = array_filter(rex_sql::factory()->getArray("SELECT * FROM rex_cronjob WHERE `type` = 'rex_cronjob_neues_publish'"));
if (!$cronjob) {
$cronjobPublish = 'FriendsOfRedaxo\\Neues\\Cronjob\\Publish';

/**
* ggf Update von früheren Versionen mit dem alten Klassennamen
* -> rex_cronjob_neues_publish ändern in FriendsOfRedaxo\Neues\Cronjob\Publish.
*/
$sql->setTable(rex::getTable('cronjob'));
$sql->setValue('type', $cronjobPublish);
$sql->setWhere('`type` = :class', [':class' => 'rex_cronjob_neues_publish']);
$sql->update();

/**
* Fehlenden CronJob eintragen.
*/
$sql = rex_sql::factory();
$sql->setTable(rex::getTable('cronjob'));
$sql->setWhere('`type` = :class', [':class' => $cronjobPublish]);
$sql->select();

if (0 === $sql->getRows()) {
$query = rex_file::get(__DIR__ . '/install/rex_cronjob_neues_publish.sql');
rex_sql::factory()->setQuery($query);
}
Expand Down
2 changes: 1 addition & 1 deletion install/rex_cronjob_neues_publish.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET NAMES utf8mb4;

INSERT INTO `rex_cronjob` (`name`, `description`, `type`, `parameters`, `interval`, `nexttime`, `environment`, `execution_moment`, `execution_start`, `status`, `createdate`, `createuser`, `updatedate`, `updateuser`) VALUES
('[neues] Geplante Beiträge veröffentlichen', 'Veröffentlicht alle Beiträge (status = 1), deren Status geplant (status = 0) ist und deren Veröffentlichungszeitpunkt erreicht wurde (publishdate < now()).', 'rex_cronjob_neues_publish', '[]', '{\"minutes\":\"all\",\"hours\":\"all\",\"days\":\"all\",\"weekdays\":\"all\",\"months\":\"all\"}', NOW(), '|frontend|backend|script|', 0, NOW(), 1, NOW(), 'neues', NOW(), 'neues');
('[neues] Geplante Beiträge veröffentlichen', 'Veröffentlicht alle Beiträge (status = 1), deren Status geplant (status = 0) ist und deren Veröffentlichungszeitpunkt erreicht wurde (publishdate < now()).', 'FriendsOfRedaxo\\Neues\\Cronjob\\Publish', '[]', '{\"minutes\":\"all\",\"hours\":\"all\",\"days\":\"all\",\"weekdays\":\"all\",\"months\":\"all\"}', NOW(), '|frontend|backend|script|', 0, NOW(), 1, NOW(), 'neues', NOW(), 'neues');
7 changes: 5 additions & 2 deletions lib/neues_restful_api.php → lib/Api/Restful.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

namespace FriendsOfRedaxo\Neues;
namespace FriendsOfRedaxo\Neues\Api;

use FriendsOfRedaxo\Neues\Author;
use FriendsOfRedaxo\Neues\Category;
use FriendsOfRedaxo\Neues\Entry;
use rex_yform_rest;
use rex_yform_rest_route;

class RestfulApi
class Restful
{
public static function init(): void
{
Expand Down
7 changes: 5 additions & 2 deletions lib/neues_rss_api.php → lib/Api/Rss.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<?php

namespace FriendsOfRedaxo\Neues;
namespace FriendsOfRedaxo\Neues\Api;

use FriendsOfRedaxo\Neues\Category;
use FriendsOfRedaxo\Neues\Entry;
use rex;
use rex_api_function;
use rex_clang;
use rex_path;
use rex_response;
use rex_string;
use rex_yform_manager_collection;
use SimpleXMLElement;

class neues_rss_api
class Rss extends rex_api_function
{
protected $published = true; // Erlaubt den Aufruf aus dem Frontend

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<?php

namespace FriendsOfRedaxo\Neues\Cronjob;

use FriendsOfRedaxo\Neues\Entry;
use rex_cronjob;
use rex_i18n;

use function count;

class rex_cronjob_neues_publish extends rex_cronjob
class Publish extends rex_cronjob
{
public function execute()
{
Expand Down
7 changes: 6 additions & 1 deletion lib/rex_cronjob_neues_sync.php → lib/Cronjob/Sync.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php

namespace FriendsOfRedaxo\Neues\Cronjob;

use FriendsOfRedaxo\Neues\Author;
use FriendsOfRedaxo\Neues\Category;
use FriendsOfRedaxo\Neues\Entry;
use rex_cronjob;
use rex_i18n;
use rex_socket;

class rex_cronjob_neues_sync extends rex_cronjob
class Sync extends rex_cronjob
{
private $rest_urls = ['category' => '/rest/neues/category/5.0.0/',
'author' => '/rest/neues/author/5.0.0/',
Expand Down
File renamed without changes.
File renamed without changes.
Loading