{"id":252,"date":"2013-12-28T20:33:52","date_gmt":"2013-12-28T20:33:52","guid":{"rendered":"https:\/\/ahorseforonebin.co.uk\/?p=252"},"modified":"2013-12-28T20:42:42","modified_gmt":"2013-12-28T20:42:42","slug":"geeking-in-php","status":"publish","type":"post","link":"https:\/\/ahorseforonebin.co.uk\/?p=252","title":{"rendered":"geeking in .php"},"content":{"rendered":"<p>I was awake until gone 4 this morning, trying to crack an apparent permissions problem on a MySQL database.<\/p>\n<p>The database runs a content management system (indexing\/categorising\/tracking metadata\/grouping and, of course, reporting.<\/p>\n<p>It was brought to my attention at about 7pm last night that the content management system wasn&#8217;t letting registered users (or administrators) add new content\/update metadata.<\/p>\n<p>This is something of a problem, for a content management system.<\/p>\n<p>Obv.<\/p>\n<p>I logged on to the database as senior user and experienced the problem first hand.<\/p>\n<p>My first thought was that the permissions had somehow become unstuck, and the user hierarchy had assumed a permission value of &#8216;null&#8217;.<\/p>\n<p>I checked the user permissions in the admin panel and they were all as they should have been.<\/p>\n<p>I flipped in to the database and looked at things from there, and saw nowt wrong there either.<\/p>\n<p>Hmm. Puzzling.<\/p>\n<p>I then spent several hours running through logical, systematic checks (eg: creating a new user, assigning standard permissions to a section, validating those permissions with the database, writing to the database from the backend with those permissions &#8211; etc, etc, etc &#8211; up and down the structural, content and permissions-based hierarchies.<\/p>\n<p>I spent several hours achieving some things and not others.<\/p>\n<p>By 4.15am I was too tired to think straight, but switching off the light didn&#8217;t help; I couldn&#8217;t sleep for ages.<\/p>\n<p>I woke at 9am and had an idea.<\/p>\n<p>What if the .php front-end was somehow fudging the permissions? Concealing functionality? Somehow?<\/p>\n<p>Unlikely, but I was running out of places to look.<\/p>\n<p>I checked the read\/write permissions on all of the trigger .php files.<\/p>\n<p>Nope, nothing off-key to be found.<\/p>\n<p>And then I had another thought.<\/p>\n<p>What if it was the design template?<\/p>\n<p>Supposing that there was a not-permissions problem, a something else kind of a problem with the design?<\/p>\n<p>Something missing? Something garbled\/corrupted? Something somewhere, that was occluding (word?) a fundamental line (or block) of executable code?<\/p>\n<p>I am not a design expert.<\/p>\n<p>I don&#8217;t do flashy front ends and high quality UX audits. I understand function point analysis, yes. I understand integration\/interfaces, yes. To a (limited) degree I understand databases of various flavours.<\/p>\n<p>But I&#8217;m not a front end developer.<\/p>\n<p>And the person who did the front end development on this application has long since vanished back to Sydney.<\/p>\n<p>I surrounded myself with the few debugging tools I have, gave myself two hours to unpick the front end code, looking for a bug, or a garble, or a thing that didn&#8217;t make any sense.<\/p>\n<p>At just under an hour I thought I was on the track of it.<\/p>\n<p>At an hour and ten minutes I knew I had the problem in my sights.<\/p>\n<p>I changed some syntax in a section of triggers, got out of bed, showered, brushed my teeth, got dressed and took the bike out for a ride.<\/p>\n<p>When I got back, a couple of hours later, I had lungfuls a plenty of fresh air, and a clear head.<\/p>\n<p>I went straight back to the area I had been working, completed the tidying up, applied the new code and blow me down, it only went and worked.<\/p>\n<p>Registered users now have read\/write access to the appropriate areas of the system (as designated by their admin settings).<\/p>\n<p>And I tidied up a very minor presentational thing that has been annoying me ever since I started looking after the product.<\/p>\n<p>What caused it?<\/p>\n<p>What was the terrible event that triggered this near-apocalyptic devastation?<\/p>\n<p>In a nutshell, I upgraded the database.<\/p>\n<p>It was a legacy product which I had just dragged up to MySQL 5.x (MySQL 5.6.15) from an unstable MySQL 4.1 &#8211; and what&#8217;s that, something like nine years old?<\/p>\n<p>The front end developer had hard-coded certain (but unnecessary) database calls in to the front end .php.<\/p>\n<p>Upgrading the database (a thing I did on Boxing Day), disconnected the hard-coding and the system had a paddy.<\/p>\n<p>It was that simple.<\/p>\n<p>Yes, very easy to believe that the problem was permission-based. But actually it was a disconnect in the front end that was producing symptoms of a\u00a0permission-based failure.<\/p>\n<p>I got there.<\/p>\n<p>A more highly-skilled front end wiz would probably have got there much quicker than I did.<\/p>\n<p>But I&#8217;m not a front end specialist.<\/p>\n<p>I&#8217;m just a geek who does stuff here and there.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was awake until gone 4 this morning, trying to crack an apparent permissions problem on a MySQL database. The database runs a content management system (indexing\/categorising\/tracking metadata\/grouping and, of course, reporting. It was brought to my attention at about 7pm last night that the content management system wasn&#8217;t letting \u2026 <a class=\"continue-reading-link\" href=\"https:\/\/ahorseforonebin.co.uk\/?p=252\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-252","post","type-post","status-publish","format-standard","hentry","category-admin"],"_links":{"self":[{"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=252"}],"version-history":[{"count":5,"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/252\/revisions"}],"predecessor-version":[{"id":257,"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/252\/revisions\/257"}],"wp:attachment":[{"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahorseforonebin.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}