我在 MODX Revolution 2.7.3 中使用 xpdo 从与 modx 安装相同的数据库中的自定义表中插入和额外数据。一切正常,只是表中的更改需要大约 20 分钟才能显示在 xpod 查询中。
例如,我有一个包含成人字段的联系人表。在表单中,我有一个下拉框,其中选项是成人联系人。它工作正常,但是当您更改联系人的成人状态时,下拉列表中的选项需要 20 分钟才能反映更改。
请参阅下面的代码
$class='Contacts';
$fields = array_keys($modx->getFields($class));
$collections = $modx->getCollection($class);
foreach($collections as $collection) {
if($collection->get($fields[4])=='YES'){
$output .= '<option value=' . $collection->get($fields[0]).'>'.$collection->get($fields[1])." ".$collection->get($fields[2]).'</option>';
}
}
return $output;
There is only one table involved and the code for creating the table is:
CREATE TABLE `cbdb_contacts` (
`contactID` int(11) NOT NULL,
`firstname` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`lastname` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
`dob` date NOT NULL,
`adult` enum('YES','NO') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'NO',
`mobile` text COLLATE utf8_unicode_ci NOT NULL,
`landline` text COLLATE utf8_unicode_ci NOT NULL,
`address` text COLLATE utf8_unicode_ci NOT NULL,
`email` text COLLATE utf8_unicode_ci NOT NULL,
`comments` longtext COLLATE utf8_unicode_ci NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table `cbdb_contacts`
--
INSERT INTO `cbdb_contacts` (`contactID`, `firstname`, `lastname`, `dob`, `adult`, `mobile`, `landline`, `address`, `email`, `comments`, `timestamp`) VALUES
(38, 'Tex', 'Brown', '2020-06-01', 'NO', '', '', '', '', '', '2020-07-12 18:34:19'),
(39, 'Mary', 'Brown', '2020-06-01', 'YES', '', '', '', '', '', '2020-07-06 19:03:23'),
(40, 'Pamela', 'Brown', '2020-06-01', 'YES', '', '', '', '', '', '2020-07-08 08:13:11'),
(41, 'Eddy', 'Green', '2020-06-01', 'NO', '', '', '', '', '', '2020-07-06 19:04:19'),
(42, 'Sheila', 'White', '2020-06-01', 'NO', '', '', '', '', '', '2020-07-12 18:54:03'),
(43, 'Dan', 'Black', '2020-06-01', 'NO', '', '', '', '', '', '2020-07-08 08:20:25'),
(134, 'Annete', 'Pray', '0000-00-00', 'NO', '', '', '', '', '', '2020-07-12 19:23:02'),
(133, 'Alex', 'Grey', '0000-00-00', 'NO', '', '', '', '', '', '2020-07-12 19:10:14'),
(132, 'Princess', 'Brown', '0000-00-00', 'NO', '', '', '', '', '', '2020-07-11 22:43:55'),
(131, 'Prince', 'Black', '0000-00-00', 'NO', '', '', '', '', '', '2020-07-11 22:39:22'),
(129, 'Tom', 'Smith', '0000-00-00', 'YES', '', '', '', '', '', '2020-07-11 22:34:32'),
(128, 'James', 'Dean', '0000-00-00', 'YES', '', '', '', '', '', '2020-07-11 22:14:19'),
(127, 'Peter', 'Paul', '0000-00-00', 'NO', '', '', '', '', '', '2020-07-11 22:08:52'),
(130, 'Tess', 'Logan', '0000-00-00', 'NO', '', '', '', '', '', '2020-07-11 22:38:35');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cbdb_contacts`
--
ALTER TABLE `cbdb_contacts`
ADD PRIMARY KEY (`contactID`),
ADD KEY `firstname` (`firstname`) USING BTREE;
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cbdb_contacts`
--
ALTER TABLE `cbdb_contacts`
MODIFY `contactID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=135;
COMMIT;