Public: Publishes this initiative

 Returns true if the record was properly saved, false otherwise.
772388
def publish!
      return false if published?
      update(
        published_at: Time.current,
        state: "published",
        signature_start_date: Date.current,
        signature_end_date: Date.current + Decidim::Initiatives.default_signature_time_period_length
      )
    end
760648
def save(self, *args, **kwargs):
        
        if self.publish_date is None:
            self.publish_date = now()
        super(Displayable, self).save(*args, **kwargs)
979294
def save(self, commit=True):
        
        if self.instance.pk:
            # First handle updates
            post = super().save(commit=False)
            post.updated_by = self.user
            post.updates_count = F('updates_count') + 1
        else:
            post = Post(
                topic=self.topic,
                subject=self.cleaned_data['subject'],
                approved=self.perm_handler.can_post_without_approval(self.forum, self.user),
                content=self.cleaned_data['content'],
                enable_signature=self.cleaned_data['enable_signature'])
            if not self.user.is_anonymous:
                post.poster = self.user
            else:
                post.username = self.cleaned_data['username']
                post.anonymous_key = get_anonymous_user_forum_key(self.user)

        # Locks the topic if appropriate.
        lock_topic = self.cleaned_data.get('lock_topic', False)
        if lock_topic:
            self.topic.status = Topic.TOPIC_LOCKED
            self.topic.save()

        if commit:
            post.save()

        return post
1317089
@Override
  public void publish(LogRecord record) {
    // Convert Log
    Throwable throwable = record.getThrown();
    if (throwable != null) {
      synchronized (ExceptionRepositoryAsMetrics.INSTANCE) {
        // We would not include the message if already exceeded the exceptions limit
        if (ExceptionRepositoryAsMetrics.INSTANCE.getExceptionsCount() >= exceptionsLimit) {
          droppedExceptionsCount.incr();
          return;
        }

        // Convert the record
        StringWriter sink = new StringWriter();
        throwable.printStackTrace(new PrintWriter(sink, true));
        String trace = sink.toString();

        Metrics.ExceptionData.Builder exceptionDataBuilder =
            ExceptionRepositoryAsMetrics.INSTANCE.getExceptionInfo(trace);
        exceptionDataBuilder.setCount(exceptionDataBuilder.getCount() + 1);
        exceptionDataBuilder.setLasttime(new Date().toString());
        exceptionDataBuilder.setStacktrace(trace);

        // Can cause NPE and crash HI
        //exceptionDataBuilder.setLogging(record.getMessage());

        if (record.getMessage() == null) {
          exceptionDataBuilder.setLogging("");
        } else {
          exceptionDataBuilder.setLogging(record.getMessage());
        }
      }
    }
  }
757162
public boolean isDataModified() {
		if (this.deletedRecords.size() > 0) {
			return true;
		}
		for (final JKTableRecord rec : this.records) {
			if (rec.getStatus() == RecordStatus.MODIFIED) {
				return true;
			}
		}
		return false;
	}
1089333
public function arePublic()
    {
        if (Schema::hasColumn($this->model->getTable(), 'is_published')) {
            $query = $this->model->where('is_published', 1);

            if (Schema::hasColumn($this->model->getTable(), 'published_at')) {
                $query->where('published_at', '<=', Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s'));
            }

            return $query->orderBy('created_at', 'desc')->get();
        }

        return $this->model->orderBy('created_at', 'desc')->get();
    }
1202603
public function doUnpublish()
    {
        $owner = $this->owner;
        // Skip if this record isn't saved
        if (!$owner->isInDB()) {
            return false;
        }

        // Skip if this record isn't on live
        if (!$owner->isPublished()) {
            return false;
        }

        $owner->invokeWithExtensions('onBeforeUnpublish');

        // Modify in isolated mode
        static::withVersionedMode(function () use ($owner) {
            static::set_stage(static::LIVE);

            // This way our ID won't be unset
            $clone = clone $owner;
            $clone->delete();
        });

        $owner->invokeWithExtensions('onAfterUnpublish');
        return true;
    }
689498
def save
      return true if !new_record? && !changed?
      raise Exceptions::ValidationFailedException.new(errors) if !valid?

      destroy if !new_record? && name_changed?

      parent.extra_data["#{key_prefix}Protocol"] = protocol
      parent.extra_data["#{key_prefix}GuestPort"] = guestport
      parent.extra_data["#{key_prefix}HostPort"] = hostport
      result = parent.extra_data.save

      clear_dirty!
      existing_record!

      result
    end
1188374
protected function isPublished(DataObject $instance)
    {
        $isPublished = false;
        if ($instance->hasMethod('isPublished')) {
            $isPublished = $instance->isPublished();
        }
        return $isPublished;
    }
594581
private void safeCommitDataset(Collection<TaskState> taskStates, DataPublisher publisher) {
    synchronized (GLOBAL_LOCK) {
      commitDataset(taskStates, publisher);
    }
  }
169462
public function save() : bool
    {
        if (!$this->isTableNameSet()) {
            return false;
        }
        $pkName = $this->primaryKey;
        if ((int) $this->$pkName > 0) {
            $this->updateEntry();
        } else {
            $this->createEntry();
        }
        return true;
    }
1135407
public function isUnpublished()
	{
		if (!array_key_exists('state', $this->_tbl->getFields()))
		{
			return false;
		}
		if ($this->get('state') == self::APP_STATE_UNPUBLISHED)
		{
			return true;
		}
		return false;
	}
877194
public boolean isSingleDetail(Rec record)
    {
        boolean bSingleDetail = true;
        
        if (Boolean.toString(false).equals(this.getMessage().getMessageHeader().get(BaseMessageHeader.SINGLE_DETAIL_PARAM)))
            return false;
        
        return bSingleDetail;
    }
989055
public boolean recordConstancy() {
    if (!currentInfo.hasConstAnnotation()) {
      currentInfo.setConstant(true);
      populated = true;
      return true;
    } else {
      return false;
    }
  }
752575
public function isPublished()
    {
        return ($this->status >= Node::PUBLISHED)
        || ($this->status >= Node::PENDING && $this->published_at <= Carbon::now());
    }
438826
public function save()
    {
        if (!$this->isNew()) {
            $this->setStatus(self::STATUS_UPDATED);
        } else {
            $this->setStatus(self::STATUS_CREATED);
        }

        return false;
    }
1256987
public function savePublish(Page $page, bool $published) : void
    {
        $page->setPublished($published);
        $page->save();
    }