b882092f5d
These changes were applied DIRECTLY to the production cPanel server via Fileman/save_file_content API calls between ~10:30 PT and 14:44 PT today. None of them were committed or pushed at the time, violating the Software → Repo rule (CLAUDE.md, added 2026-05-18). Captured by Claude (VSCode-side) at Sami request so the changes can be reviewed/cherry-picked instead of being silently lost. Notable concerns: - class-beep.php shrank from 3387 → 1395 bytes (likely truncation, not edit) - beep.css shrank from 35431 → 22948 bytes (-12.5 KB; ~half the file gone) - class-replies.php shrank from 8793 → 6406 bytes - 3 new files (class-magic-links.php, class-follows.php, create_poll_tables.php) were created server-only with no repo presence Source: live cPanel snapshot at /tmp/beep-snapshot-2026-05-20/
56 lines
1.6 KiB
PHP
56 lines
1.6 KiB
PHP
<?php
|
|
// Load WordPress
|
|
$paths = [
|
|
"/home/samihost/sami-ahmed.net/wp-load.php",
|
|
dirname(__FILE__) . "/wp-load.php",
|
|
dirname(dirname(__FILE__)) . "/wp-load.php"
|
|
];
|
|
foreach ($paths as $p) {
|
|
if (file_exists($p)) {
|
|
require_once $p;
|
|
break;
|
|
}
|
|
}
|
|
if (!defined("ABSPATH")) {
|
|
die("Could not find wp-load.php");
|
|
}
|
|
// Create poll tables
|
|
global $wpdb;
|
|
$polls_table = $wpdb->prefix . "beep_polls";
|
|
$votes_table = $wpdb->prefix . "beep_poll_votes";
|
|
$charset = $wpdb->get_charset_collate();
|
|
|
|
$polls_sql = "CREATE TABLE IF NOT EXISTS $polls_table (
|
|
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
beep_id BIGINT(20) UNSIGNED NOT NULL,
|
|
question TEXT NOT NULL,
|
|
options TEXT NOT NULL,
|
|
votes TEXT NOT NULL DEFAULT '[]',
|
|
total_votes BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
|
|
ends_at DATETIME NULL,
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (id),
|
|
KEY beep_id (beep_id)
|
|
) $charset;";
|
|
|
|
$votes_sql = "CREATE TABLE IF NOT EXISTS $votes_table (
|
|
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
poll_id BIGINT(20) UNSIGNED NOT NULL,
|
|
user_id BIGINT(20) UNSIGNED NOT NULL,
|
|
option_index INT NOT NULL,
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (id),
|
|
UNIQUE KEY poll_user (poll_id, user_id),
|
|
KEY poll_id (poll_id),
|
|
KEY user_id (user_id)
|
|
) $charset;";
|
|
|
|
require_once(ABSPATH . "wp-admin/includes/upgrade.php");
|
|
$result1 = dbDelta($polls_sql);
|
|
$result2 = dbDelta($votes_sql);
|
|
echo "Tables created: $polls_table, $votes_table";
|
|
echo "
|
|
Result1: " . print_r($result1, true);
|
|
echo "
|
|
Result2: " . print_r($result2, true);
|
|
?>
|