Jump to content

Community

teraßyte

+Clients
  • Posts

    31,895
  • Joined

  • Days Won

    11

 Content Type 

Profiles

Downloads

IPS4 Providers

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Forums

Store

Everything posted by teraßyte

  1. I forgot to post the error I'm getting, here it is: class_uses(): object or string expected This happens because the function isQuestion() doesn't exist and once the code reaches the else part with the \IPS\IPS::classUsesTrait( $this, 'IPS\Content\Solvable' ) check the static::$commentClass variable doesn't exist and NULL is used instead.
  2. I have an application that uses only $reviewClass and NO $commentClass which throws an error after upgrading to 4.6. This happens because loading the reviews then goes on to call the function _comments() from system\Content\Item::reviews() to load the data. The error is because of this code added in system\Content\Item::_comments() to handle solved contents, statistics, and recognized content (lines 4349-4400): /* Solved count */ $commentClass = static::$commentClass; $showSolvedStats = FALSE; if ( method_exists( $this, 'isQuestion' ) and $this->isQuestion() ) { $showSolvedStats = TRUE; } else if ( \IPS\IPS::classUsesTrait( $this, 'IPS\Content\Solvable' ) and ( $this->containerAllowsMemberSolvable() OR $this->containerAllowsSolvable() ) ) { $showSolvedStats = TRUE; } if ( $showSolvedStats ) { $memberIds = array(); $solvedCounts = array(); $authorField = $commentClass::$databaseColumnMap['author']; foreach( $results as $id => $data ) { $memberIds[ $data->$authorField ] = $data->$authorField; } if ( \count( $memberIds ) ) { foreach( \IPS\Db::i()->select( 'COUNT(*) as count, member_id', 'core_solved_index', array( \IPS\Db::i()->in( 'member_id', $memberIds ) ), NULL, NULL, 'member_id' ) as $member ) { $solvedCounts[ $member['member_id'] ] = $member['count']; } foreach( $results as $id => $data ) { if ( isset( $solvedCounts[ $data->$authorField ] ) ) { $results[ $id ]->author_solved_count = $solvedCounts[ $data->$authorField ]; } } } } /* Recognized content */ if ( \IPS\IPS::classUsesTrait( $commentClass, 'IPS\Content\Recognizable' ) ) { foreach( \IPS\Db::i()->select( '*', 'core_member_recognize', [ [ 'r_content_class=?', $commentClass ], [ \IPS\Db::i()->in('r_content_id', array_keys( $results ) ) ] ] ) as $row ) { if ( isset( $results[ $row['r_content_id'] ] ) ) { $results[ $row['r_content_id'] ]->recognized = \IPS\core\Achievements\Recognize::constructFromData( $row ); } } } To solve the issue I had to wrap the whole thing in an IF check for the class: if ( isset(static::$commentClass) ) { //... {
  3. In \applications\core\api\hello.php you have this code: public function GETindex() { return new \IPS\Api\Response( 200, array( 'communityName' => \IPS\Settings::i()->board_name, 'communityUrl' => \IPS\Settings::i()->base_url, 'ipsApplications' => \IPS\Application::load('core')->version, 'ipsApplications' => array_filter( array_keys( \IPS\Application::applications() ), function( $k ) { return \in_array( $k, \IPS\IPS::$ipsApps ); } ) ) ); } The version line used to have the ipsVersion key, looks like it was overwritten by mistake with ipsApplications: 'ipsVersion' => \IPS\Application::load('core')->version
  4. They can just make it a default template with a code option to change it if you need it to be different. They already do such thing for other templates in the suite already anyway; it's nothing new.
  5. Let me see what I can do about stripping it down to a simple application. The current one relies on having also other apps installed at the same time so you wouldn't be able to test with it alone.
  6. In system/Content/Search/Elastic/Index.php::resetLastComment() you have this code on lines 877-884: $where = NULL; if( $ignoreId !== NULL ) { $commentClass = $itemClass::$commentClass; $commentIdColumn = $commentClass::$databaseColumnId; $where = array( $commentClass::$databaseTable . '.' . $commentClass::$databasePrefix . $commentIdColumn . '<>?', $ignoreId ); } The problem is that one of my custom applications does not implement the \IPS\Content\Comment but only \IPS\Content\Review. The code above clearly doesn't check if the comments class is available before trying to load/use it. And the fix here is not to simply skip the ignore code if no Comment class is available, but it should be using the correct Comment/Review class based on the class data being passed to it. Here's a log of the error btw: Error: Class name must be a valid object or a string (0) #0 /home/domain.com/public_html/system/Content/Search/Elastic/Index.php(412): IPS\Content\Search\Elastic\_Index->resetLastComment(Array, 43058, 4048) #1 /home/domain.com/public_html/system/Content/Comment.php(883): IPS\Content\Search\Elastic\_Index->removeFromSearchIndex(Object(IPS\reviews\Product\Review)) #2 /home/domain.com/public_html/system/Content/Review.php(396): IPS\Content\_Comment->delete() #3 /home/domain.com/public_html/applications/reviews/sources/Generic/Item.php(1714): IPS\Content\_Review->delete() #4 /home/domain.com/public_html/system/Helpers/Table/Content.php(679): IPS\reviews\Generic\_Item->mergeIn(Array, false) #5 /home/domain.com/public_html/system/Helpers/Table/Content.php(227): IPS\Helpers\Table\_Content->multimod() #6 /home/domain.com/public_html/applications/reviews/modules/front/products/browse.php(108): IPS\Helpers\Table\_Content->__construct('IPS\\reviews\\Pro...', Object(IPS\Http\Url\Friendly), Array) #7 /home/domain.com/public_html/applications/reviews/modules/front/products/browse.php(35): IPS\reviews\modules\front\products\_browse->_category(Object(IPS\reviews\Pcategory)) #8 /home/domain.com/public_html/system/Dispatcher/Controller.php(96): IPS\reviews\modules\front\products\_browse->manage() #9 /home/domain.com/public_html/system/Dispatcher/Dispatcher.php(152): IPS\Dispatcher\_Controller->execute() #10 /home/domain.com/public_html/index.php(13): IPS\_Dispatcher->run() #11 {main} The issue above happens with Elastic Search, but most likely the normal MySQL search has the same issue.
  7. Let me throw in a quick reminder for IPS to update also the Review class too if they ever get to this (since it often gets forgotten)...
  8. I've noticed a recurring template_error logged in ACP, after looking into it some more it seems to be thrown when someone replies to a status update on a profile and ES tries to index it. Here's the message and backtrace: TypeError: Argument 1 passed to IPS\Content\Search\Elastic\_Index::getIndexId() must implement interface IPS\Content\Searchable, instance of IPS\core\Statuses\Reply given, called in /public_html/system/Content/Search/Elastic/Index.php on line 888 and defined in /public_html/system/Content/Search/Elastic/Index.php:403 Stack trace: #0 /public_html/system/Content/Search/Elastic/Index.php(888): IPS\Content\Search\Elastic\_Index->getIndexId(Object(IPS\core\Statuses\Reply)) #1 /public_html/system/Content/Search/Elastic/Index.php(245): IPS\Content\Search\Elastic\_Index->resetLastComment(Array, 8206) #2 /public_html/system/Content/Item.php(4389): IPS\Content\Search\Elastic\_Index->index(Object(IPS\core\Statuses\Status)) #3 /public_html/system/Content/Item.php(4155): IPS\Content\_Item->processCommentForm(Array) #4 /public_html/uploads/template_disk_cache/template_3_5c14eba1ca1801cfb0f753db22fb4a43_statuses.php(664): IPS\Content\_Item->commentForm() #5 /public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_core_front_statuses->statusContainer(Object(IPS\core\Statuses\Status), Array, Array, false) #6 /public_html/applications/core/sources/Statuses/Status.php(743): IPS\Theme\_SandboxedTemplate->__call('statusContainer', Array) #7 /public_html/system/Content/Search/Result/Content.php(94): IPS\core\Statuses\_Status::searchResult(Array, Array, Array, NULL, Array, NULL, true, 'expanded', false, false, NULL, Array) #8 /public_html/uploads/template_disk_cache/template_3_af46883c13caa197f9e387620d19e6ec_profile.php(2506): IPS\Content\Search\Result\_Content->html() #9 /public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_core_front_profile->profileActivity(Object(IPS\Member), Object(IPS\Content\Search\Results), '\n<form accept-c...') #10 /public_html/applications/core/modules/front/members/profile.php(296): IPS\Theme\_SandboxedTemplate->__call('profileActivity', Array) #11 /public_html/system/Dispatcher/Controller.php(96): IPS\core\modules\front\members\_profile->manage() #12 /public_html/applications/core/modules/front/members/profile.php(73): IPS\Dispatcher\_Controller->execute() #13 /public_html/system/Dispatcher/Dispatcher.php(152): IPS\core\modules\front\members\_profile->execute() #14 /public_html/index.php(13): IPS\_Dispatcher->run() #15 {main} #0 /public_html/system/Theme/SandboxedTemplate.php(71): IPS\_Log::log(Object(TypeError), 'template_error') #1 /public_html/applications/core/sources/Statuses/Status.php(743): IPS\Theme\_SandboxedTemplate->__call('statusContainer', Array) #2 /public_html/system/Content/Search/Result/Content.php(94): IPS\core\Statuses\_Status::searchResult(Array, Array, Array, NULL, Array, NULL, true, 'expanded', false, false, NULL, Array) #3 /public_html/uploads/template_disk_cache/template_3_af46883c13caa197f9e387620d19e6ec_profile.php(2506): IPS\Content\Search\Result\_Content->html() #4 /public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_core_front_profile->profileActivity(Object(IPS\Member), Object(IPS\Content\Search\Results), '\n<form accept-c...') #5 /public_html/applications/core/modules/front/members/profile.php(296): IPS\Theme\_SandboxedTemplate->__call('profileActivity', Array) #6 /public_html/system/Dispatcher/Controller.php(96): IPS\core\modules\front\members\_profile->manage() #7 /public_html/applications/core/modules/front/members/profile.php(73): IPS\Dispatcher\_Controller->execute() #8 /public_html/system/Dispatcher/Dispatcher.php(152): IPS\core\modules\front\members\_profile->execute() #9 /public_html/index.php(13): IPS\_Dispatcher->run() #10 {main}
  9. I recall reading we should report bugs here now? Not 100% sure though... 🙄 Anyway, the task applications/core/tasks/clearincompletemembers.php is not properly cleaning up incomplete accounts for those who signed up with FB/Twitter/etc. We've noticed this issue for a while now, but today I had a better look at it and figured out the issue. The problem is caused by this code on line 54: foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array( array( '(name=? OR email=?)', '', '' ), array( '! (members_bitoptions2 & 16384 ) AND joined<? AND (last_visit=0 OR last_visit IS NULL)', \IPS\DateTime::create()->sub( new \DateInterval( 'PT1H' ) )->getTimestamp() ) ) ), 'IPS\Member' ) as $incompleteMember ) The query fails to load any row because the check last_visit=0 fails since the column in the DB contains the value NULL instead. I changed that bit of code to account for both values and the task is working as it should now: (last_visit=0 OR last_visit IS NULL) Full code: foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array( array( '(name=? OR email=?)', '', '' ), array( '! (members_bitoptions2 & 16384 ) AND joined<? AND (last_visit=0 OR last_visit IS NULL)', \IPS\DateTime::create()->sub( new \DateInterval( 'PT1H' ) )->getTimestamp() ) ) ), 'IPS\Member' ) as $incompleteMember )
  10. As per title ^. When using an area that has reviews enabled (like a File in Downloads) the NEWEST/MOST HELPFUL buttons are NOT available on mobile view. Some people have report it as a bug on our site, but since it's more feedback(?) I'm posting here.
  11. When running the support tool in ACP the guest caching is NOT cleared (since it now uses a different class \IPS\Output\Cache). This causes the old CSS/JS files to be deleted and regenerated but the guest-cached pages returned from the cache still use the old urls causing all pages to be broken. Right now the guests cache is cleared ONLY by a couple of tasks (cleanup.php + clearcache.php) but until those tasks run the pages are broken as I mentioned above.
  12. It would probably help more if you can post the code in your Reborn.php file. Just remove any sensitive data before posting it.
  13. @Kevin Carwile Found a few more errors on the front-end this time around (the one above was in ACP). Here's a list below (all missing root namespaces - also IPS is custting down on call_user_func_array & func_get_args as well): Whoops\Exception\ErrorException thrown with message "You have used a function (in_array) that should be called from the root namespace for performance reasons (applications/advancedtagsprefixes/hooks/forumLastPostPrefix.php::270)." if ( isset( static::$contentItemClass ) and \IPS\Settings::i()->tags_enabled and in_array( 'IPS\Content\Tags', class_implements( static::$contentItemClass ) ) ) ==== Whoops\Exception\ErrorException thrown with message "You have used a function (is_null) that should be called from the root namespace for performance reasons (applications/advancedtagsprefixes/hooks/nodeModel.php::66)." There are 2 "is_null" instances on the same line here. if ( static::isTaggable() === TRUE and !is_null( static::$permApp ) and !is_null( static::$permType ) ) === Whoops\Exception\ErrorException thrown with message "You have used a function (in_array) that should be called from the root namespace for performance reasons (applications/advancedtagsprefixes/hooks/nodeModel.php::233)." if ( isset( static::$contentItemClass ) and \IPS\Settings::i()->tags_enabled and in_array( 'IPS\Content\Tags', class_implements( static::$contentItemClass ) ) ) === In the hook "applications/advancedtagsprefixes/hooks/forumLastPostPrefix.php" replace 3 instances of "call_user_func_array/func_get_args": return call_user_func_array( 'parent::setLastComment', func_get_args() ); with: return parent::setLastComment($comment); === In the hook "applications/advancedtagsprefixes/hooks/forumLastPostPrefix.php" replace 1 instance of "call_user_func_array/func_get_args/is_null": $result = call_user_func_array( 'parent::lastPost', func_get_args() ); if( !is_null( $result ) ) with: $result = parent::lastPost(); if( !\is_null( $result ) ) === In the hook "applications/advancedtagsprefixes/hooks/forumLastPostPrefix.php" replace 1 instance of "is_array/in_array": is_array( \IPS\Member::loggedIn()->modPermission( 'forums' ) ) and in_array( $this->_id, \IPS\Member::loggedIn()->modPermission( 'forums' ) ) with: \is_array( \IPS\Member::loggedIn()->modPermission( 'forums' ) ) and \in_array( $this->_id, \IPS\Member::loggedIn()->modPermission( 'forums' ) )
  14. @Adriano Faria Just a quick note that this application throws an error when using IN_DEV with 4.4 because 6 functions in the file applications/linkedaccounts/hooks/la_getAccounts.php don't use the root namespace. I simply updated the 2 functions in this line below 3 times: return call_user_func_array( 'parent::' . __FUNCTION__, func_get_args() ); to: return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
  15. @Kevin Carwile Here's a quick bug report after I upgraded the application to 3.2.0 on a site I manage for someone: PHP Warning: Declaration of IPS\Content\advancedtagsprefixes_hook_addPrefixToForm::tagsFormField($item, $container) should be compatible with IPS\Content\_Item::tagsFormField($item, $container, $minimized = false) in 141 on line 407 The fix is to simply update line 233 in the hook from: public static function tagsFormField( $item, $container ) to: public static function tagsFormField( $item, $container, $minimized = FALSE ) and also line 260 from: parent::tagsFormField( $item, $container ) to: parent::tagsFormField( $item, $container, $minimized ) 👍
  16. Just an update that's I've updated my dev board and I'm working on this mod (in my spare free time >.<). I'm currently looking into the activity stream issue and I also need to recode a portion of it to adhere to the new marketplace rules about no colums in the default tables. As far as I can remember I fixed that bug quite a while ago, but for the fix to work you first need to re-install the last version available and then uninstall it. If that still doesn't work let me know.
  17. I will take a look at the compatibility of this mod with 4.4.1 (and possibly all other mods, too) this weekend. Just a quick update for everyone since I've received a few PMs about it in the last days 🙂
  18. You have ) in the wrong place in your code after 'access_server', move it at the end: $form->add( new \IPS\Helpers\Form\Text('access_server',\IPS\Settings::i()->access_server) );
  19. Yeah, I can hook into specific classes but not the main one. For example I want to make all apps not save a point for the chosen reputation under certain circumstances. I'd have to go around making an hook on each class for each application I want to support. And I just can't go around adding support for any 3rd party apps 1 by 1. I could do it, but I won't. I'll use my time in better ways 🙂
  20. I guess it's about time to send a rescue team? The explorers got lost along the way it seems... 🙄 Jokes aside. I found myself needing to hook into one of the reactions functions and remembered this topic. It seems nothing has changed since then.
  21. At a first quick look the code seems okay. Can you paste here the exact error you're getting? The backtrace might help understand the problem.
  22. After taking another look it seems collect is set to enabled=0 in the table but lock column is 3, so the task is properly NOT running. But then the message should not show for disabled tasks in the first place. Stuart already confirmed he submitted a fix for it though, so all good anyway ?
  23. I thought that the tasks for disabled applications/plugins was finally fixed in 4.3.x but it seems this is still not the case. You have "fixed" the tasks table in the ACP to not show the tasks for disabled applications & plugins but the tasks themselves are still running in background anyway. I noticed because I got a warning about a task that kept locking even thought the application it is attached to is disabled. This is the code you use to load the tasks to display in the table: $table = new \IPS\Helpers\Table\Db( 'core_tasks', \IPS\Http\Url::internal( 'app=core&module=settings&controller=advanced&do=tasks' ), array( array( '(p.plugin_enabled=1 OR a.app_enabled=1)' ) ) ); $table->joins = array( array( 'select' => 'a.app_enabled', 'from' => array( 'core_applications', 'a' ), 'where' => "a.app_directory=app" ), array( 'select' => 'p.plugin_enabled', 'from' => array( 'core_plugins', 'p' ), 'where' => "p.plugin_id=plugin" ) ); And this is the code actually used to load the next tasks that will actually run: /** * Get next queued task * * @return \IPS\Task|NULL */ public static function queued() { $fifteenMinutesAgo = ( time() - 900 ); foreach ( \IPS\Db::i()->select( '*', 'core_tasks', array( 'next_run<? AND enabled=1', ( time() + 60 ) ), 'next_run ASC', NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER ) as $task ) { // [...] } return NULL; } Should I report it as a bug, or was this done on purpose to let the tasks keep running regardless anyway? Because this is highly confusing.
  24. I actually implemented something similar to getData in a couple of my custom apps since I needed it exactly for caching. I totally support this.
  25. I believe the support tool compares the database and the schema.json file in your application's data folder. Is that file updated too with the columns removed? EDIT Btw, instead of dropping each column by itself, why not just drop them all at once? The function supports also an array as column value: $toDrop = array( 'g_school_comission_sale', 'g_can_act_as_dean', 'g_can_view_history', 'g_can_delete_schools', 'g_can_view_closed_schools', 'g_can_edit_schools', 'g_can_feature_schools', 'g_can_unfeature_schools', 'g_change_owner', 'g_can_create_schools', 'g_nr_schools', 'g_can_link_unlink_club', 'g_can_change_school_status', 'g_can_move_courses', 'g_can_assign_instructors', 'g_bulk_message_school', 'g_bulk_message_school', 'g_can_create_courses', 'g_can_create_module', 'g_can_create_lesson', 'g_can_create_courses', 'g_bulk_message', 'g_can_mark_lesson_complete', 'g_can_add_students_manually', 'g_can_feature_courses', 'g_can_customize_schools', 'g_can_instructor', 'g_can_create_affiliates', 'g_can_create_quiz', 'g_can_add_lesson_notes', 'g_can_unfeature_courses', 'g_view_history' ); try { \IPS\Db::i()->dropColumn( 'core_groups', $toDrop ); } catch( \IPS\Db\Exception $e ){}
×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy