Skip to content

Commit

Permalink
Merge pull request #44 from alexplusde/cronjob-publish
Browse files Browse the repository at this point in the history
Cronjob zum Veröffentlichen - Status-Wert ändert sich!
alxndr-w authored Dec 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 8f933b2 + 4523158 commit e1fcdc6
Showing 11 changed files with 940 additions and 18 deletions.
7 changes: 7 additions & 0 deletions install.php
Original file line number Diff line number Diff line change
@@ -16,3 +16,10 @@

rex_media_service::addMedia($data, false);
}

/* Cronjob installieren */
$cronjob = array_filter(rex_sql::factory()->getArray("SELECT * FROM rex_category WHERE `type` = 'rex_cronjob_neues_publish'"));
if(!$cronjob) {
$query = rex_file::get(rex_path::addon('neues', 'install/rex_cronjob_neues_publish.sql'));
rex_sql::factory()->setQuery($query);
}
4 changes: 4 additions & 0 deletions install/rex_cronjob_neues_publish.sql
Original file line number Diff line number Diff line change
@@ -0,0 +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');
843 changes: 842 additions & 1 deletion install/tableset.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion lang/de_de.lang
Original file line number Diff line number Diff line change
@@ -50,8 +50,9 @@ neues_status = Veröffentlicht?
neues_status_notice = Gibt an, ob dieser News-Beitrag aktuell sichtbar sein soll (veröffentlicht/geplant) oder sich noch im Entwurfsstadium befindet.
neues_category_status_notice = Gibt an, ob diese Kategorie aktuell sichtbar sein soll (veröffentlicht/geplant) oder sich noch im Entwurfsstadium befindet.
neues_status_online = Veröffentlicht
neues_status_offline = Offline
neues_status_planned = Geplant
neues_status_draft = Entwurf
neues_status_deleted = Verworfen

neues_domain_ids = Websites
neues_domain_ids_notice = Hier können Sie festlegen, ob die News nur auf einer oder auf mehreren Websites innerhalb dieser REDAXO-Installation veröffentlicht werden soll.
@@ -87,3 +88,9 @@ neues_docs_neues_language = Sprachen
neues_docs_url = URL-Adon
neues_docs_rss = RSS-Feed
neues_docs_restful_api = YForm RESTful API

# Cronjob

neues_entry_publish_success = %s Beiträge wurden erfolgreich veröffentlicht.
neues_entry_publish_error = %s Beiträge konnten nicht veröffentlicht werden.
neues_entry_publish_cronjob = Geplante Beiträge veröffentlichen. (Aktuelles)
12 changes: 9 additions & 3 deletions lang/en_gb.lang
Original file line number Diff line number Diff line change
@@ -49,10 +49,9 @@ neues_status = Published?
neues_status_notice = Indicates whether this news post should currently be visible (published/scheduled) or is still in the draft stage.
neues_category_status_notice = Indicates whether this category should currently be visible (published/scheduled) or is still in the draft stage.
neues_status_online = Published
neues_status_offline = Offline
neues_status_planned = Planned
neues_status_draft = Draft
neues_domain_ids = Websites
neues_date_ids = Entries
neues_status_deleted = Discarded

neues_language = Language
neues_language_name = Language
@@ -61,6 +60,7 @@ neues_language_code = Language code (ISO 639-1)
neues_language_code_notice = Two-letter language code according to ISO standard, e.g.<code>en</code>
neues_language_entry = Manage entries
neues_language_entry_notice = Manage linked dates

neues_domain_ids = Websites
neues_domain_ids_notice = Here you can specify whether the news should be published on one or more websites within this REDAXO installation.
neues_date_ids = Entries
@@ -87,3 +87,9 @@ neues_docs_neues_language = Languages
neues_docs_url = URL Addon
neues_docs_rss = RSS Feed
neues_docs_restful_api = YForm RESTful API

# Cronjob

neues_entry_publish_success = %s posts have been successfully published.
neues_entry_publish_error = %s posts could not be published.
neues_entry_publish_cronjob = Publish planned posts. (Current)
9 changes: 8 additions & 1 deletion lang/es_es.lang
Original file line number Diff line number Diff line change
@@ -49,8 +49,9 @@ neues_status = ¿Publicado?
neues_status_notice = Indica si esta entrada de noticias debe ser visible actualmente (publicada/programada) o si todavía está en la etapa de borrador.
neues_category_status_notice = Indica si esta categoría debe ser visible actualmente (publicada/programada) o si todavía está en la etapa de borrador.
neues_status_online = Publicado
neues_status_offline = Desconectado
neues_status_planned = Planeado
neues_status_draft = Borrador
neues_status_deleted = Descartado

neues_domain_ids = Sitios web
neues_domain_ids_notice = Aquí puede determinar si las noticias deben publicarse solo en uno o en varios sitios web dentro de esta instalación de REDAXO.
@@ -86,3 +87,9 @@ neues_docs_neues_language = Sprachen
neues_docs_url = URL-Adon
neues_docs_rss = RSS-Feed
neues_docs_restful_api = YForm RESTful API

# Cronjob

neues_entry_publish_success = %s entradas se han publicado con éxito.
neues_entry_publish_error = %s entradas no se pudieron publicar.
neues_entry_publish_cronjob = Publicar entradas planificadas. (Actual)
9 changes: 8 additions & 1 deletion lang/fr_fr.lang
Original file line number Diff line number Diff line change
@@ -50,8 +50,9 @@ neues_status = Publié ?
neues_status_notice = Indique si cet article de nouvelles doit actuellement être visible (publié/prévu) ou s'il est encore à l'état de brouillon.
neues_category_status_notice = Indique si cette catégorie doit actuellement être visible (publiée/prévue) ou si elle est encore à l'état de brouillon.
neues_status_online = Publié
neues_status_offline = Hors ligne
neues_status_planned = Prévu
neues_status_draft = Brouillon
neues_status_deleted = Supprimé

neues_domain_ids = Sites web
neues_domain_ids_notice = Ici, vous pouvez déterminer si les nouvelles doivent être publiées sur un ou plusieurs sites web au sein de cette installation REDAXO.
@@ -87,3 +88,9 @@ neues_docs_neues_language = Langues
neues_docs_url = Addon URL
neues_docs_rss = Flux RSS
neues_docs_restful_api = API RESTful YForm

# Cronjob

neues_entry_publish_success = %s articles ont été publiés avec succès.
neues_entry_publish_error = %s articles n'ont pas pu être publiés.
neues_entry_publish_cronjob = Publier des articles planifiés. (Actuel)
9 changes: 8 additions & 1 deletion lang/it_it.lang
Original file line number Diff line number Diff line change
@@ -50,8 +50,9 @@ neues_status = Pubblicato?
neues_status_notice = Indica se questo articolo di notizie dovrebbe essere attualmente visibile (pubblicato/pianificato) o se è ancora in fase di bozza.
neues_category_status_notice = Indica se questa categoria dovrebbe essere attualmente visibile (pubblicata/pianificata) o se è ancora in fase di bozza.
neues_status_online = Pubblicato
neues_status_offline = Offline
neues_status_planned = Pianificato
neues_status_draft = Bozza
neues_status_deleted = Scartato

neues_domain_ids = Siti web
neues_domain_ids_notice = Qui puoi decidere se le notizie devono essere pubblicate su uno o più siti web all'interno di questa installazione REDAXO.
@@ -87,3 +88,9 @@ neues_docs_neues_language = Lingue
neues_docs_url = Addon URL
neues_docs_rss = Feed RSS
neues_docs_restful_api = YForm API RESTful

# Cronjob

neues_entry_publish_success = %s articoli sono stati pubblicati con successo.
neues_entry_publish_error = %s articoli non sono stati pubblicati.
neues_entry_publish_cronjob = Pubblica articoli pianificati. (Corrente)
25 changes: 16 additions & 9 deletions lang/sv_se.lang
Original file line number Diff line number Diff line change
@@ -49,8 +49,9 @@ neues_status = Publicerad?
neues_status_notice = Anger om detta nyhetsinlägg ska vara synligt just nu (publicerat/schemalagt) eller om det fortfarande är i utkaststadiet.
neues_category_status_notice = Anger om denna kategori ska vara synlig just nu (publicerat/schemalagt) eller om det fortfarande är i utkaststadiet.
neues_status_online = Publicerad
neues_status_offline = Offline
neues_status_planned = Planerad
neues_status_draft = Utkast
neues_status_deleted = Kasserad

neues_domain_ids = Webbplatser
neues_domain_ids_notice = Här kan du bestämma om nyheterna ska publiceras på bara en eller flera webbplatser inom denna REDAXO-installation.
@@ -75,14 +76,20 @@ neues_author_be_user_id = REDAXO-användare

# Doku

neues_docs_a_intro = Einleitung
neues_docs_a_intro = Introduktion
neues_docs_b_import_export = Import/Export
neues_docs_c_migration = Migration
neues_docs_settings = Einstellungen
neues_docs_neues_entry = Einträge
neues_docs_neues_category = Kategorien
neues_docs_neues_author = Autor:innen
neues_docs_neues_language = Sprachen
neues_docs_url = URL-Adon
neues_docs_rss = RSS-Feed
neues_docs_settings = Inställningar
neues_docs_neues_entry = Inlägg
neues_docs_neues_category = Kategorier
neues_docs_neues_author = Författare
neues_docs_neues_language = Språk
neues_docs_url = URL-Addon
neues_docs_rss = RSS-flöde
neues_docs_restful_api = YForm RESTful API

# Cronjob

neues_entry_publish_success = %s inlägg har publicerats framgångsrikt.
neues_entry_publish_error = %s inlägg kunde inte publiceras.
neues_entry_publish_cronjob = Publicera planerade inlägg.
29 changes: 29 additions & 0 deletions lib/rex_cronjob_neues_publish.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

class rex_cronjob_neues_publish extends rex_cronjob
{
public function execute()
{

/* Collection von Neues-Einträgen, die noch nicht veröffentlicht sind, aber es sein sollten. (geplant) */
$neues_entry_to_publish = neues_entry::query()->where('status', 0)->where('publishdate', date('Y-m-d'), '<')->find();
$neues_entry_to_publish->setValue('status', 1);
if (!$neues_entry_to_publish->save()) {
$this->setMessage(sprintf(rex_i18n::msg('neues_entry_publish_error'), count($neues_entry_to_publish)));
return false;
}

$this->setMessage(sprintf(rex_i18n::msg('neues_entry_publish_success'), count($neues_entry_to_publish)));
return true;
}

public function getTypeName()
{
return rex_i18n::msg('neues_entry_publish_cronjob');
}

public function getParamFields()
{
return [];
}
}
2 changes: 1 addition & 1 deletion package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package: neues
version: '3.3.2'
version: '4.0.0-dev'
author: 'Alexander Walther'
supportpage: https://alexplusde.github.io/neues/
load: late

0 comments on commit e1fcdc6

Please sign in to comment.