]> git.mxchange.org Git - friendica.git/commitdiff
Move first_day_of_week pconfig key to calendar category
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 17 Dec 2022 07:07:46 +0000 (02:07 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 17 Dec 2022 17:20:14 +0000 (12:20 -0500)
database.sql
src/Model/Event.php
src/Module/Settings/Display.php
static/dbstructure.config.php
update.php

index 49f282db0a315e5d76739e54ab871cefdcf8e7fb..ebae144365006b79c9a70c1ec3ce0fa08dca34dd 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2022.12-rc (Giant Rhubarb)
--- DB_UPDATE_VERSION 1501
+-- DB_UPDATE_VERSION 1502
 -- ------------------------------------------
 
 
index 06d391745da3cc760a97363c7256384cf6ee2571..28e325dbae31601ffbf1a844bc5e55e2e15c83e4 100644 (file)
@@ -412,66 +412,64 @@ class Event
        public static function getStrings(): array
        {
                // First day of the week (0 = Sunday).
-               $firstDay = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'first_day_of_week', 0);
-
-               $i18n = [
-                       "firstDay" => $firstDay,
-                       "allday"   => DI::l10n()->t("all-day"),
-
-                       "Sun" => DI::l10n()->t("Sun"),
-                       "Mon" => DI::l10n()->t("Mon"),
-                       "Tue" => DI::l10n()->t("Tue"),
-                       "Wed" => DI::l10n()->t("Wed"),
-                       "Thu" => DI::l10n()->t("Thu"),
-                       "Fri" => DI::l10n()->t("Fri"),
-                       "Sat" => DI::l10n()->t("Sat"),
-
-                       "Sunday"    => DI::l10n()->t("Sunday"),
-                       "Monday"    => DI::l10n()->t("Monday"),
-                       "Tuesday"   => DI::l10n()->t("Tuesday"),
-                       "Wednesday" => DI::l10n()->t("Wednesday"),
-                       "Thursday"  => DI::l10n()->t("Thursday"),
-                       "Friday"    => DI::l10n()->t("Friday"),
-                       "Saturday"  => DI::l10n()->t("Saturday"),
-
-                       "Jan" => DI::l10n()->t("Jan"),
-                       "Feb" => DI::l10n()->t("Feb"),
-                       "Mar" => DI::l10n()->t("Mar"),
-                       "Apr" => DI::l10n()->t("Apr"),
-                       "May" => DI::l10n()->t("May"),
-                       "Jun" => DI::l10n()->t("Jun"),
-                       "Jul" => DI::l10n()->t("Jul"),
-                       "Aug" => DI::l10n()->t("Aug"),
-                       "Sep" => DI::l10n()->t("Sept"),
-                       "Oct" => DI::l10n()->t("Oct"),
-                       "Nov" => DI::l10n()->t("Nov"),
-                       "Dec" => DI::l10n()->t("Dec"),
-
-                       "January"   => DI::l10n()->t("January"),
-                       "February"  => DI::l10n()->t("February"),
-                       "March"     => DI::l10n()->t("March"),
-                       "April"     => DI::l10n()->t("April"),
-                       "June"      => DI::l10n()->t("June"),
-                       "July"      => DI::l10n()->t("July"),
-                       "August"    => DI::l10n()->t("August"),
-                       "September" => DI::l10n()->t("September"),
-                       "October"   => DI::l10n()->t("October"),
-                       "November"  => DI::l10n()->t("November"),
-                       "December"  => DI::l10n()->t("December"),
-
-                       "today" => DI::l10n()->t("today"),
-                       "month" => DI::l10n()->t("month"),
-                       "week"  => DI::l10n()->t("week"),
-                       "day"   => DI::l10n()->t("day"),
-
-                       "noevent" => DI::l10n()->t("No events to display"),
-
-                       "dtstart_label"  => DI::l10n()->t("Starts:"),
-                       "dtend_label"    => DI::l10n()->t("Finishes:"),
-                       "location_label" => DI::l10n()->t("Location:")
-               ];
+               $firstDay    = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'calendar', 'first_day_of_week') ?? 0;
 
-               return $i18n;
+               return [
+                       'firstDay'    => $firstDay,
+                       'allday'      => DI::l10n()->t('all-day'),
+
+                       'Sun' => DI::l10n()->t('Sun'),
+                       'Mon' => DI::l10n()->t('Mon'),
+                       'Tue' => DI::l10n()->t('Tue'),
+                       'Wed' => DI::l10n()->t('Wed'),
+                       'Thu' => DI::l10n()->t('Thu'),
+                       'Fri' => DI::l10n()->t('Fri'),
+                       'Sat' => DI::l10n()->t('Sat'),
+
+                       'Sunday'    => DI::l10n()->t('Sunday'),
+                       'Monday'    => DI::l10n()->t('Monday'),
+                       'Tuesday'   => DI::l10n()->t('Tuesday'),
+                       'Wednesday' => DI::l10n()->t('Wednesday'),
+                       'Thursday'  => DI::l10n()->t('Thursday'),
+                       'Friday'    => DI::l10n()->t('Friday'),
+                       'Saturday'  => DI::l10n()->t('Saturday'),
+
+                       'Jan' => DI::l10n()->t('Jan'),
+                       'Feb' => DI::l10n()->t('Feb'),
+                       'Mar' => DI::l10n()->t('Mar'),
+                       'Apr' => DI::l10n()->t('Apr'),
+                       'May' => DI::l10n()->t('May'),
+                       'Jun' => DI::l10n()->t('Jun'),
+                       'Jul' => DI::l10n()->t('Jul'),
+                       'Aug' => DI::l10n()->t('Aug'),
+                       'Sep' => DI::l10n()->t('Sept'),
+                       'Oct' => DI::l10n()->t('Oct'),
+                       'Nov' => DI::l10n()->t('Nov'),
+                       'Dec' => DI::l10n()->t('Dec'),
+
+                       'January'   => DI::l10n()->t('January'),
+                       'February'  => DI::l10n()->t('February'),
+                       'March'     => DI::l10n()->t('March'),
+                       'April'     => DI::l10n()->t('April'),
+                       'June'      => DI::l10n()->t('June'),
+                       'July'      => DI::l10n()->t('July'),
+                       'August'    => DI::l10n()->t('August'),
+                       'September' => DI::l10n()->t('September'),
+                       'October'   => DI::l10n()->t('October'),
+                       'November'  => DI::l10n()->t('November'),
+                       'December'  => DI::l10n()->t('December'),
+
+                       'today' => DI::l10n()->t('today'),
+                       'month' => DI::l10n()->t('month'),
+                       'week'  => DI::l10n()->t('week'),
+                       'day'   => DI::l10n()->t('day'),
+
+                       'noevent' => DI::l10n()->t('No events to display'),
+
+                       'dtstart_label'  => DI::l10n()->t('Starts:'),
+                       'dtend_label'    => DI::l10n()->t('Finishes:'),
+                       'location_label' => DI::l10n()->t('Location:')
+               ];
        }
 
        /**
index 1484790d9a52b9bbc11659f1c183081054ccfd0e..a263d2992a76d36e5d25c1550cac60d05e0f2efa 100644 (file)
@@ -93,9 +93,9 @@ class Display extends BaseSettings
                DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'hide_dislike'            , !$enable_dislike);
                DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'display_resharer'        , $display_resharer);
                DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'stay_local'              , $stay_local);
-               DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'first_day_of_week'       , $first_day_of_week);
                DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'preview_mode'            , $preview_mode);
 
+               DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'calendar', 'first_day_of_week'     , $first_day_of_week);
                if (in_array($theme, Theme::getAllowedList())) {
                        if ($theme == $user['theme']) {
                                // call theme_post only if theme has not been changed
index d9ff07178bd05b4f393124583f22bdaae5a3741c..f621da2ebe5056f128b16b72cdd23af4b0cac0f0 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1501);
+       define('DB_UPDATE_VERSION', 1502);
 }
 
 return [
index 12a3fb74e61800c094512a046aa93431f6e67ee5..82f4fba58bc847c106cd72f6a9a5f03434aedfc7 100644 (file)
@@ -1138,4 +1138,10 @@ function update_1497()
 {
        DBA::e("UPDATE `user` SET `last-activity` = DATE(`login_date`) WHERE `last-activity` IS NULL");
        return Update::SUCCESS;
-}
\ No newline at end of file
+}
+
+function update_1502()
+{
+       DBA::e("UPDATE `pconfig` SET `cat` = 'calendar' WHERE `k` = 'first_day_of_week'");
+       return Update::SUCCESS;
+}