简体   繁体   English

表达式引擎SimpleXmlIterator损坏

[英]Expression Engine SimpleXmlIterator broken

this is my first question, which I can't figure out how to make relevant to other people as per the guidelines. 这是我的第一个问题,我无法根据指南确定如何与他人建立联系。 I suppose just a question at the end as to whether a noob should ever attempt to meddle with code they don't fully understand. 最后,我想一个问题是,菜鸟是否应该尝试使用他们尚未完全理解的代码。

My site depends on an xml database generated elsewhere which is spliced into site-specific format, set up by the original developer. 我的网站依赖于在其他位置生成的xml数据库,该数据库被拼接成由原始开发人员设置的特定于站点的格式。 The system generating the database changed a tag from "contact" to "person", breaking the data formula for the splicing. 生成数据库的系统将标签从“联系人”更改为“人”,从而破坏了拼接的数据公式。 (Grr.) (GRR)。

I thought I had fixed it, because I changed the tag in the receiving file, but the splicer has just stopped completely. 以为我已修复它,因为我更改了接收文件中的标签,但是接合器刚刚完全停止。 (Basically, I don't really know enough about the site/coding to have attempted to make these changes. But I thought I could get away with it!) (基本上,我对站点/编码的了解还不足以尝试进行这些更改。但是我认为我可以摆脱它!)

This is what I understand happens: 1. every night we send an xml file into folder 2. a php file reformats the raw xml with SimpleXmlIterator. 这是我的理解:1.每晚我们将xml文件发送到文件夹中2. php文件使用SimpleXmlIterator重新格式化原始xml。 3. that sends the reformatted file to a staging.sql file. 3.将重新格式化的文件发送到staging.sql文件。 4. that sends it to the right place for the site to load it nightly. 4.将其发送到正确的位置,以便网站每晚进行加载。

Step 4 is still happening, but the site is using the same data over and over. 步骤4仍在进行中,但是站点反复使用相同的数据。 The new data is just not making it through step 2 and 3. 新数据只是没有通过步骤2和3。

This is what I did (I just commented out the original code. I'm "SOC"): 这就是我所做的(我刚刚注释掉了原始代码。我是“ SOC”):

$authors = array();
foreach ($author_array as $arr) {

  $bio = ($arr['copy_biography']) ? nl2br(htmlspecialchars($arr['copy_biography'], ENT_QUOTES)) : '';

  // SOC changed $author_title = $arr['contact_first_name'] .' '. $arr['contact_surname'];
  $author_title = $arr['person_first_name'] .' '. $arr['person_surname'];
  $authors[] = array(
    'title'     => $author_title,
    'author_id' => $arr['id'],
    // SOC changed from this to the below 'fname'     => $arr['contact_first_name'],
    'fname'     => $arr['person_first_name'],
    // SOC changed from this to the below 'lname'     => $arr['contact_surname'],
    'lname'     => $arr['person_surname'],
    // SOC ditto 'website'   => $arr['contact_web_page'],
    'website'   => $arr['person_web_page'],
    'bio'       => $bio,
    // SOC ditto 'twitter'   => $arr['contact_fax']
    'twitter'   => $arr['person_fax']
  );
}

$authors = generate_valid_xml_from_array($authors);
$authors_xml = '/var/www/hotkeybooks/biblio/authors_import.xml';
$authorfile = fopen($authors_xml,'w') or die("can't open file");
fwrite($authorfile,$authors);
fclose($authorfile);
//make the files readable
exec('chmod 444 /var/www/hotkeybooks/biblio/*.xml');

I also changed “contact” to “person” the staging.sql and the staging.tgz. 我还将staging.sql和staging.tgz的“联系人”更改为“人”。

-- ----------------------------
--  Records of `exp_dd_doc_sections`
-- ----------------------------
BEGIN;
INSERT INTO `exp_dd_doc_sections` VALUES (…….<td>contact_first_name, contact_surname</td>\n         <td>Text Input</td>\n           <td>Would enter author full name, this field would only be used for admin purposes.</td>\n          <td>y</td>\n        </tr>\n     <tr>\n          <td>Author Biblio ID</td>\n         <td>author_biblio_id</td>\n         <td>id</td>\n           <td>Text Input</td>\n           <td>Used for relationship building and reference only</td>\n            <td></td>\n     </tr>\n     <tr>\n          <td>Author First Name</td>\n            <td>author_fname</td>\n         <td>contact_first_name</td>\n           <td>Text Input</td>\n           <td></td>\n         <td></td>\n     </tr>\n     <tr>\n          <td>Author Last Name</td>\n         <td>author_lname</td>\n         <td>contact_surname</td>\n          <td>Text Input</td>\n           <td></td>\n         <td></td>\n     </tr>\n ………)

Does anyone know which bit of what I did broke the system, and what I can do to restore it? 有谁知道我做了什么破坏系统,以及如何恢复系统? I have tried overwriting my changes with the original files, but that hasn't helped. 我曾尝试用原始文件覆盖我的更改,但这并没有帮助。

Any guidance would be greatly appreciated. 任何指导将不胜感激。

Sounds like you need some basic troubleshooting. 听起来您需要一些基本的疑难解答。

Perhaps your parsing is working correctly but the transfer between the various locations is failing due to file permissions or something. 也许您的解析工作正常,但是由于文件权限或其他原因,各个位置之间的传输失败。

Working backwards: 向后工作:

Can you confirm that the file that is transferred in step 4 is a new file? 您可以确认在步骤4中传输的文件是新文件吗? Does it have the expected modified date? 是否有预期的修改日期? Does it have the expected data? 有预期的数据吗?

Can you confirm that the file in step 3 staging.sql is a new file with the expected modified date? 您可以确认步骤3 staging.sql中的文件是具有预期修改日期的新文件吗? Does it have the expected data? 有预期的数据吗?

Can you confirm that the file created in step 2 is a new file with the expected date and data? 您可以确认在第2步中创建的文件是带有预期日期和数据的新文件吗?

Do you seeing anything in your error log to suggest that anything in the script has failed? 您是否在错误日志中看到任何提示脚本错误的信息?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM