From a8b204dad8397c9295c025d197361a10bb80fffa Mon Sep 17 00:00:00 2001 From: techchud Date: Sat, 13 Sep 2025 01:18:51 -0500 Subject: wordpress definition --- aux-files/wordpress/wp-config.patch | 88 +++++++++++++++++++++++++++++++++++++ wordpress.scm | 25 +++++++++++ 2 files changed, 113 insertions(+) create mode 100644 aux-files/wordpress/wp-config.patch create mode 100644 wordpress.scm diff --git a/aux-files/wordpress/wp-config.patch b/aux-files/wordpress/wp-config.patch new file mode 100644 index 0000000..d8411fb --- /dev/null +++ b/aux-files/wordpress/wp-config.patch @@ -0,0 +1,88 @@ +From d38739dfd5209fcd8d4568d5a64282cdaf9bc7e5 Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Sat, 13 Sep 2025 00:49:13 -0500 +Subject: [PATCH] add debians wp-config.php + +--- + wp-content/wp-config.php | 69 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 69 insertions(+) + create mode 100644 wp-content/wp-config.php + +diff --git a/wp-content/wp-config.php b/wp-content/wp-config.php +new file mode 100644 +index 0000000..2b9efe2 +--- /dev/null ++++ b/wp-content/wp-config.php +@@ -0,0 +1,69 @@ ++.php or /etc/wordpress/config-.php ++ */ ++$debian_server = preg_replace('/:.*/', "", $_SERVER['HTTP_HOST']); ++$debian_server = preg_replace("/[^a-zA-Z0-9.\-]/", "", $debian_server); ++ ++/* Check for variable set by admin using SetEnv or SetEnvIf */ ++if (isset($_SERVER['WORDPRESS_CONFIG']) ++ && preg_match("/^[a-zA-Z0-9-]+$/", $_SERVER['WORDPRESS_CONFIG'])) { ++ $debian_file = '/etc/wordpress/config-'.$_SERVER['WORDPRESS_CONFIG'].'.php'; ++} else { ++ $debian_file = '/etc/wordpress/config-'.strtolower($debian_server).'.php'; ++} ++ ++/* Main site in case of multisite with subdomains */ ++$debian_main_server = preg_replace("/^[^.]*\./", "", $debian_server); ++$debian_main_file = '/etc/wordpress/config-'.strtolower($debian_main_server).'.php'; ++ ++if (file_exists($debian_file)) { ++ require_once($debian_file); ++ define('DEBIAN_FILE', $debian_file); ++} elseif (file_exists($debian_main_file)) { ++ require_once($debian_main_file); ++ define('DEBIAN_FILE', $debian_main_file); ++} elseif (file_exists("/etc/wordpress/config-default.php")) { ++ require_once("/etc/wordpress/config-default.php"); ++ define('DEBIAN_FILE', "/etc/wordpress/config-default.php"); ++} else { ++ header("HTTP/1.0 404 Not Found"); ++ echo "Neither $debian_file nor $debian_main_file could be found.
Ensure one of them exists, is readable by the webserver and contains the right password/username."; ++ exit(1); ++} ++ ++/* Switch off automatic core updates (should be done by package update) */ ++define('WP_AUTO_UPDATE_CORE', false); ++ ++/* Default value for some constants if they have not yet been set ++ by the host-specific config files */ ++if (!defined('ABSPATH')) ++ define('ABSPATH', '/usr/share/wordpress/'); ++if (!defined('WP_ALLOW_MULTISITE')) ++ define('WP_ALLOW_MULTISITE', true); ++if (!defined('DB_NAME')) ++ define('DB_NAME', 'wordpress'); ++if (!defined('DB_USER')) ++ define('DB_USER', 'wordpress'); ++if (!defined('DB_HOST')) ++ define('DB_HOST', 'localhost'); ++if (!defined('WP_CONTENT_DIR') && !defined('DONT_SET_WP_CONTENT_DIR')) ++ define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content'); ++ ++/* Default value for the table_prefix variable so that it doesn't need to ++ be put in every host-specific config file */ ++if (!isset($table_prefix)) { ++ $table_prefix = 'wp_'; ++} ++ ++if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ++ $_SERVER['HTTPS'] = 'on'; ++ ++require_once(ABSPATH . 'wp-settings.php'); ++?> +-- +2.49.0 + diff --git a/wordpress.scm b/wordpress.scm new file mode 100644 index 0000000..5608429 --- /dev/null +++ b/wordpress.scm @@ -0,0 +1,25 @@ +(define-module (wordpress) + #:use-module (guix build-system copy) + #:use-module (guix packages) + #:use-module (gnu packages) + #:use-module (guix download) + #:use-module ((guix licenses) :prefix license:) + ) + +(define-public wordpress + (package + (name "wordpress") + (version "6.8.2") + (source + (origin + (method url-fetch) + (uri (string-append "https://wordpress.org/wordpress-" version ".tar.gz")) + (sha256 (base32 "0asychxz3ljf3h7n4fnca2m754398imbqbiwdf0nds5zjbip4nnq")) + ;(patches (search-patches "aux-files/wordpress/wp-config.patch")) + (patches (search-patches "/home/joybuke/Documents/ComputerScience/Projects/techchud/guix-techchud/aux-files/wordpress/wp-config.patch")) + )) + (build-system copy-build-system) + (home-page "https://wordpress.org") + (synopsis "A web content management system") + (description "WordPress is a powerful and flexible content management system (CMS) that allows users to create and manage websites easily. It is built on PHP and MySQL, making it a popular choice for bloggers, businesses, and developers alike. With a vast library of themes and plugins, WordPress enables extensive customization, allowing users to tailor their sites to meet specific needs without requiring extensive coding knowledge.") + (license (list license:gpl2+)))) -- cgit v1.2.3