New revs

Nao

  • Dadman with a boy
  • Posts: 16,061
Re: New revs
« Reply #2355, on December 31st, 2013, 11:51 AM »
[byebye-themes-part-deux 7f58d5b]
 27 files changed, 383 insertions(+), 618 deletions(-)

- Started removing id_theme and we::$user['theme'] from Wedge, and turning theme previews into skin previews, things like that. The loadTheme function has a much simpler intro now, being 54 lines shorter. Still need to turn themes into skins entirely, notably all of the edit/copy/install code, but it's not as urgent, and I might remove them entirely and rely on FTP exclusively. (Most of the files in this commit are concerned by this, so I won't list them. I only need to list files when I need to quickly find a specific change I made in a large commit, really.)

* Rewrote the skin selector (both the plugin and Themes.php versions) to get rid of all theme code. Also used the opportunity to cache the results, so it'll save quite a bit of parsing on every page if you're using the SkinSelector plugin, really. Also, skin previews are no longer stored in the session variable, because if you can navigate your way through the skin selector in a preview state, then I'm sure you can make your decision immediately, without needing to browse the forum. I'm even considering removing the feature altogether, but as of now it's only using a couple of lines, so it's alright. (Load.php, Themes.php, Themes.template.php)

+ Proper support for choosing the 'default skin' from within the skin selectors, rather than just the currently default skin. e.g., choosing 'default skin' will reset your choice to what a guest would see, and if the admin changes the default skin, your skin will follow that choice. (Many files.)

! loadLanguage() no longer takes '+' separated strings as arguments. Oops. (Load.php)

- A very, very old bug: $file[3] was never used in loadLanguage(), meaning the last param was always declared for nothing. (Load.php)

- Removed id_theme from language_changes table. This is only half-done, I have yet to commit ManageLanguages with which I've been having problems. So, basically, the language editor won't work in the current commit. Sorry about that. (Load.php, install.sql)

* Moved issue_http_header() to Errors, the only place where it was used. (Subs.php, Errors.php)

* Note: $ssi_theme is now $ssi_skin, as could be expected. (SSI.php, Load.php)

@ Note: there's a bit of a hack in the skin code update. As of now, default skin = '', root skin = '/' and non-root skin = 'folder'. The slash in root skin doesn't match the non-root folder structure, but this is because I didn't want the extra slash to be stored in all non-root skin choices. That's probably a bad idea, but I'd still rather not have unneeded bytes in skin names, because of their varchar nature within database keys. If I can't live with that hack, I'll restore the starting slash on skin names.

@ Note: $context['skin'] is still being filled in, and represents the folder of your current skin, relative to the skin folder. The new $context['skin_actual'] is also interesting, as it holds your skin choice, which can include 'default', and is used internally in more places.

@ Note: listing here all database changes that need to be made by anyone who currently has Wedge installed. Remove boards:id_theme, add boards:skin_mobile based on boards:skin (haven't yet written this feature, though), remove language_changes:id_theme and update the associated keys, remove members:id_theme and members:id_theme_mobile, add a skin(20) key to members, and remove themes:id_theme. Also, you may want to go to your admin panel, and update the default skins, because the format has changed. You should also reset everyone's skins, for the same reason, or update them manually with phpMyAdmin.
Re: New revs
« Reply #2356, on December 31st, 2013, 11:56 AM »
[byebye-themes-part-deux 79ff022]
 16 files changed, 32 insertions(+), 36 deletions(-), 30.67 KiB[1]

! Fixed a typo in a very ironic language string key (error_occured). (Errors.php, Login2.php, index.language.php)

! Pete bug: wrong variable name ($members, should be $member). (ScheduledTasks.php)

- Unneeded globals. (ManageMembergroups.php)

* cache_get_data() should be tested against null with a strict operator. (Class-Editor.php, Recent.php, Stats.php, Subs-BBC.php, Subs-Editor.php, Subs-Media.php, also files in previous commit.)

* Files weren't using the SMILEYS constant. Well, they should have. I should also update for SMILEYS_DIR, it'll come later. (ManageSmileys.php, ManageSmileys.template.php, Profile.template.php)
 1. Patch size for this push includes the previous commit, too.
Re: New revs
« Reply #2357, on December 31st, 2013, 01:05 PM »
[byebye-themes-part-deux 0653c3a]
 10 files changed, 169 insertions(+), 8 deletions(-), 2.79 KiB

+ I haven't updated it in a while and it's still good enough, so it's probably committable material... So here it is, Wilderless. A silly pun on Wilde, Wireless and Wilderness. If I have to explain it, it's probably that it sucks. Suggestions for a better name are welcome. (Wilde/Wilderless/*, install.sql)

- More id_theme stuff. (ManageMail.php, ManageRegistration.php)

- theme_dir. (Aeva-Gallery.php)

- smileys_url. (Subs-Cache.php)
Re: New revs
« Reply #2358, on January 1st, 2014, 06:12 PM »
[byebye-themes-part-deux 2711527]
 10 files changed, 564 insertions(+), 611 deletions(-), 5.14 KiB

* Replaced $helptxt['*'] with $txt['help_*'], which was unused across the entire codebase. It's an absolute waste of time and resources to use a different array for these, really... Especially when it came to caching. Another 50 lines saved in Load.php, it's now below 90KB, having lost nearly 10KB since the theme removal process was started. 10KB of PHP your server won't have to load on every page, and I mean it. (Admin.php, Help.php, Load.php, ManageServer.php, Subs-Template.php, Help.language.php)

* valid_filename() provides a better solution (IMHO) than md5() when it comes to handling the language cache filenames. If I find any issues with it later, it's only a matter of changing two lines. (Load.php, Subs.php)

@ There are more files related to this change, but they're planned for a later commit. I don't think not committing them now will break Wedge, though. Also, Help.language.php changes about 170 lines per file, but it's all about the variables being renamed, nothing else, so don't bother.
Re: New revs
« Reply #2359, on January 1st, 2014, 06:21 PM »
[byebye-themes-part-deux c5d3e64] -- this one has the actual meat of my rewrite. And, themes are nearly all gone!
 8 files changed, 276 insertions(+), 367 deletions(-), 4.49 KiB

* Rewrote (quite extensively) the language editor to be usable in a theme-less context. Removed $themes[..]['theme_dir'] and $images_dir, which were unnused. (ManageLanguages.php, ManageLanguages.template.php)

* language_changes table changes: lang_var is gone (thanks to the $helptxt rewrite), and replaced with is_plugin, a boolean value that replaces the id_theme value from yore. From what I can see, it all works just fine, and that is_plugin thing is only here for convenience and speed. (install.sql)

! Pete bug: plugins with sub-folders would show up several times in the language file list. (ManageLanguages.php)

! Pete bug: the language editor didn't correctly support entities in language strings. Basically, westr::safe() behaves similarly to the modern version of htmlspecialchars, except it also turns entities into UTF-8 characters if possible. It's not *always* desirable, as in here. (ManageLanguages.template.php)

* Turned language file descriptions into something a bit more usable. (ManageLanguages.php, ManageLanguages.template.php, ManageSettings.language.php)

- Removed the last remaining create_function calls. Those that are still here, are not doable with a lambda function. Also, removed an unneeded global. (ManageLanguages.php, ManageMail.php)

! JS error in custom fields code. (ManageMemberOptions.php)
Re: New revs
« Reply #2360, on January 2nd, 2014, 12:34 PM »
[master 62c5304]
 455 files changed, 17 insertions(+), 37 deletions(-), 6.40 KiB

* With most of the theme removal completed, it's time to get to the meat of it... Moved these folders to /assets/. Ah, finally!!
  /Themes/default/images (to its root)
  /Themes/default/fonts (to fonts)
  /Themes/default/aeva (to aeva)
  /Smileys/ (to smileys)
  /avatars/ (to avatars)

* Updated code to match new URLs or simply remove support for per-theme image folders. Don't worry, I've got something in the works that will be ten times better than that crappy system anyway! (QueryString.php, Themes.php, Themes.language.php, install.php, install.sql)

- Removed a custom file I shouldn't have committed. Not a biggie, though, it had like 2 lines. (Wilderless/custom.css)

* Commenazi. (SSI.php, Subs-Template.php)
Re: New revs
« Reply #2361, on January 2nd, 2014, 01:34 PM »
[master 0e0a700]
 15 files changed, 40 insertions(+), 45 deletions(-), 2.29 KiB

* Renamed $settings['avatar_directory'] to 'avatar_dir', for consistency with other variables. (ManageAttachments.php, Profile-Modify.php, Admin.language.php, install.sql)

* Renamed theme_id to source_id in some function, to avoid confusion. (ManageLanguages.php)

* Renamed $settings['avatar_url'] to AVATARS where possible. That's not a lot, but it doesn't really matter. (Load.php, Subs.php, Profile.template.php)

- Removed $context['avatar_url'], never used AFAIK. (Profile-Modify.php)

- Removed another file that didn't get deleted properly. (Smileys/.htaccess)

- Removed unused globals. (ManageLanguages.php, ManageSmileys.php, Aeva-Gallery.php, Subs-Media.php, Themes.template.php)
Re: New revs
« Reply #2362, on January 3rd, 2014, 01:59 PM »
[master a226178] -- this is *all* I had left to commit apart from JS and CSS tweaks that I'm taking years to complete, hmm...
 12 files changed, 82 insertions(+), 51 deletions(-), 3.61 KiB

+ Added ability to choose your cache type, so, most likely, to force the file cache if another cache type is discovered. This is due to the fact that wedge.org's APC cache is much less efficient than the file cache. I could probably tweak some php.ini settings to fix that, but let's face it, the file cache is often just as efficient as any other cache type, so in addition to this, I've made file caching the default setting. Then you can enable debug mode to check your performance numbers, and cycle through the various caching options available to you, and decide which one is best for your server. (Class-System.php, ManageServer.php, ManageSettings.php, Settings.php, Settings_bak.php, ManageSettings.language.php)

* cache_get_data now accepts an extra callback parameter where you can put a cache generation lambda function that returns the data to be cached. (Subs-Cache.php)

! Fixed warning message for users without any contact lists. (Class-System.php)

! Settings.php data saving didn't allow for select-box-based variables. (ManageServer.php)

! wesql::fetch_all and fetch_rows needed some help in case the original request returned no results. (Class-DB.php)

* Commenazi, and details. (index.php, Credits.php)

@ Note: I'd originally started working on a session-based cache, and was thrilled by the performance improvement (about 10% compared to file-based), but: (1) it depends on whether your database is on your server or a dedicated server, and even whether that dedicated server is efficient (or you could just disable database sessions), (2) I don't think it's worth the hassle overall. While it's interesting to fetch and store all cache data within one single free database call, it also takes more time to unserialize. I'm still keeping the idea around (possibly in a new branch), but right now, I don't want to deal with the TTL and expiration issues this technique implied.
Re: New revs
« Reply #2363, on January 4th, 2014, 05:02 PM »
[master 6872d91]
 16 files changed, 38 insertions(+), 38 deletions(-), 10.75 KiB (Seriously, these patch sizes are getting more and more disconnected from reality. I won't carry on with them once I automatize log posting.)

* Fixed code to consider /Themes/default moved up one level. The actual move will happen once I manage to do it, there are always files that cause problems, so I'll have to do it from a cleaner repo. (QueryString.php, Subs-Template.php, Themes.php, index.template.php, install.php, install.sql, readme_install.html)

! Fixed some asset URLs. (Class-Editor.php, Subs-Sound.php, ManageMembergroups.template.php, ManageSettings.language.php, editor.js, register.js, suggest.js, install.sql, readme_install.html, ssi_examples.php)
Re: New revs
« Reply #2364, on January 4th, 2014, 06:01 PM »
[master 252c2b1]
 309 files changed, 4 deletions(-), 327 bytes

* Okay, moved folders up a level, as I said. Give me some time to prepare myself for a more radical move. (Themes/default/* -> Themes/)
Re: New revs
« Reply #2365, on January 4th, 2014, 06:43 PM »
[master ed3e209]
 4 files changed, 7 insertions(+), 17 deletions(-), 1.02 KiB

! No need for reservedVars when these are no longer put into $theme. (Profile-Modify.php)

- Removed ability to access $theme folder in skins. This never had any use anyway. (Subs-Cache.php, index.css)

* Details. (Wilderless/extra.css)
Re: New revs
« Reply #2366, on January 4th, 2014, 08:11 PM »
[master e7f4016]
 3 files changed, 13 insertions(+), 8 deletions(-), 859 bytes

! Avoid caching PHP files from external libraries. Namely, getid3 really. (index.php)

* westr::nl2br goes back to using nl2br($str, false) instead of a regex, and the whole world is better for it. I should probably remove westr::nl2br altogether, but have you ever heard of laziness..? Yes? Okay. (Class-DB.php, Class-String.php)
Re: New revs
« Reply #2367, on January 5th, 2014, 12:33 AM »
[master ddd1ea9]
 1 file changed, 5 insertions(+), 2 deletions(-), 708 bytes

! A supposedly more accurate detection method for touch devices. (script.js)

! Fixed an odd issue with triggering popup animations in Chrome. (script.js)
Re: New revs
« Reply #2368, on January 5th, 2014, 12:38 AM »
[master 576ef4f]
 3 files changed, 24 insertions(+), 17 deletions(-), 1.65 KiB

+ Introducing support for a 'hardware' version of follow_me. (topic.js, common.css, sections.css)

@ I'm using quotes because Chrome Mobile clearly emulates it through JavaScript (there's an unbearable delay when scrolling through a page), and thus forced me to disable it on it. So, I'm not sure whether other browsers use a JS layer to do this, and if it's faster than my own implementation. Also, recently Blink made some changes and started treating inactive stickies as static, so I had to 'fix' that. Also, it's all totally untested in iOS 6. I figured, okay, I've been postponing this for too long, let's commit it, otherwise I never will. If it breaks (again), it's just a single commit to revert.
Posted: January 5th, 2014, 12:35 AM

:edit: ! Aw, shucks. Forgot to remove that line. (topic.js)
Re: New revs
« Reply #2369, on January 5th, 2014, 09:58 PM »
[master 7287e90]
 7 files changed, 37 insertions(+), 39 deletions(-), 3.06 KiB

* Tweaks to the phpinfo page. (ManageServer.php)

! Trying for a fix to an undefined index. Dunno if that'll help. (Profile-Modify.php)

! Wedge was still crashing if disabling the currently selected cache system. This small rewrite is now guaranteed to work. (Subs-Cache.php)

* Minor usability tweak for login page. (Login.template.php)

* Layout tweaks for reminder page. (Reminder.template.php)

* Commenazi. (common.css)

- Removing my fix for popup transitions, because I'm afraid it didn't work as well as I thought. This is all down to an actual Blink bug on which I've wasted my afternoon. I can't even determine how the bug is triggered. All I know is that it happens if you're loading a popup when the web page is at the top. If you scroll by at least 60 pixels down, everything starts working as expected. I'd be very, very grateful if someone could work it out for me. I managed to make it work at the top by adding a dummy 3D transform on top of the opacity one, but then it gets funny: sometimes, neither the transition nor the end point of the animation are triggered at all, meaning you don't get the 'dim' effect. I figured I preferred the original glitch to this new one, so here we are. Five lines of changelog to explain why I'm removing half a line from the codebase. (script.js)